Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Block] Latest Posts - Excerpt Read More link replaced with unlinked bracketed elipsis on live site #50492

Closed
cuemarie opened this issue May 9, 2023 · 3 comments · Fixed by #51190
Assignees
Labels
[Block] Latest Posts Affects the Latest Posts Block [Type] Bug An existing feature does not function as intended

Comments

@cuemarie
Copy link

cuemarie commented May 9, 2023

Description

With any FSE theme active, the Latest Posts block displays an unlinked [...] in place of the Excerpt "Read More" link on the live site.

Step-by-step reproduction instructions

  1. Activate an FSE theme such as TT3
  2. In a page or post, add the Latest Posts block
  3. Enable Post Content > Excerpts, reduce the number of characters enough to see "Read More" links appear in the editor.
  4. Save and view site

The Live site shows [...] wherever the editor showed "Read More", and the link is removed.

Screenshots, screen recording, code snippet

Editor

Markup on 2023-05-09 at 16:03:42

Live Site

Markup on 2023-05-09 at 16:04:09

Environment info

  • WordPress 6.2
  • Gutenberg 15.7.1
  • Replicated on themes: Twenty Twenty Three, Twenty Twenty Two, Blank Canvas, Skatepark

Originally reported here: Automattic/wp-calypso#76739

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@ramonjd ramonjd added [Block] Latest Posts Affects the Latest Posts Block [Type] Bug An existing feature does not function as intended labels May 10, 2023
@ramonjd
Copy link
Member

ramonjd commented May 10, 2023

I'd class this as a bug as I'd expect the read more links to match.

I naively tried this code in the latest-posts/index.php and it works pretty well.

	$filter_latest_posts_excerpt_more = function( $more ) use ( $attributes ) {
		$use_excerpt = 'excerpt' === $attributes['displayPostContentRadio'];
		return $use_excerpt ? '<a href="' . esc_url( get_permalink() ) . '" rel="noopener noreferrer">' . __( 'Read more', 'gutenberg' ) . '</a>' : $more;
	};

I think we'd need to make sure there some explicit instruction from the latest block post since some themes might use excerpt_more filter to handle the more link displayed after a trimmed excerpt.

'excerpt' === $attributes['displayPostContentRadio'] should be enough.

Possibly related:

@annezazu
Copy link
Contributor

I can replicate with GB 15.9.

@ramonjd
Copy link
Member

ramonjd commented Jun 8, 2023

Could folks test this PR out to see if it's a good approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Latest Posts Affects the Latest Posts Block [Type] Bug An existing feature does not function as intended
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants