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

Content before the More button is truncated and unavailable if it's too long and if the excerpt is hidden on full page #44062

Open
Ryokuhi opened this issue Sep 11, 2022 · 4 comments
Labels
[Block] More Affects the More Block - used for displaying the 'Read More' link [Type] Enhancement A suggestion for improvement.

Comments

@Ryokuhi
Copy link

Ryokuhi commented Sep 11, 2022

Description

When the More block is added to a post, only the content before it should appear on the archives page. This is true only if the content before the More block isn't too long: if it's long enough, it's instead truncated and only the beginning of it appears on the archive page (possibly, together with the "Read more link text" that can be set in the editor).

The problem is that, when one selects the option of the More block to "Hide the excerpt on the full content page", the truncated part of the content before the More block itself doesn't show anywhere in the front end.

I'm not sure what the expected behavior in this situation should be: either everything before the More block should appear on the archive page, independently of its length, or the truncated content should appear on the full content page, which can be complicated as the content can be truncated even in the middle of a sentence.
I tend to think that the expected behavior should be the former, as it would respect the choice of the content creator.

Step-by-step reproduction instructions

  1. Install WordPress. The Gutenberg plugin is not needed, but installing it makes no difference.
  2. Create a new post. The post should contain three blocks.
    • A Paragraph block containing enough content for it to be truncated on the homepage.
    • A More block, with the "Hide the excerpt on the full content page" toggle active (the option is in the sidebar).
    • Another Paragraph block.
  3. Visit the full content page and check that only the Paragraph block after the More block is on display.
  4. Visit the homepage of the website and check that the content before the More block is truncated. The truncated content is available nowhere on the website.

Screenshots, screen recording, code snippet

Here is a possible post that allows reproducing the bug.
A test post with three blocks in the editor: a long Paragraph block, a More block, and another Paragraph block.

This is the full content page: only content after the More block is displayed.
The same post of the previous image, shown on the frontend.

This is the homepage: the content before the More block is truncated and what follows appears nowhere.
The homepage of the website, with the beginning of the post truncated.

Environment info

  • WordPress 6.0.2.
  • Tested both without Gutenberg and with Gutenberg 14.0.2.
  • Reproduced both with Twenty Twenty-Two and Twenty Twenty-One themes. The bug doesn't appear in Twenty Twenty, possibly because this theme doesn't show excerpts, not even when they are explicitly added to a post.
  • Browsers: Chrome 105.0.5195.102, Edge 105.0.1343.33, Firefox 104.0.2, Firefox Developer 105.0b9, Opera 90.0.4480.84.
  • Laptop with Windows 10 Home.

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

@Ryokuhi Ryokuhi added the [Block] More Affects the More Block - used for displaying the 'Read More' link label Sep 11, 2022
@carolinan
Copy link
Contributor

If the archive page is set up to show the excerpt, then displaying the excerpt is the intended behavior.

@Ryokuhi
Copy link
Author

Ryokuhi commented Sep 12, 2022

👋 @carolinan
I agree with you. There are two problems, though.

  • The issue I'm reporting is about what happens when the user doesn't add a custom excerpt to the post: in this situation, the excerpt is automatically generated from the post content, truncating it and possibly hiding part of the post content itself.
  • If the archive page is set up to show the excerpt, the page contains a custom excerpt, and it also contains a More block with the "Hide the excerpt on the full content page" option selected, then the excerpt is shown on the archive page, the content after the More block is shown on the full content page and the content before the More block doesn't show up.

These two problems are related, but I'm not sure if it would be better to continue the discussion about the second point here, move it to #41854, or open a new issue altogether.

@carolinan
Copy link
Contributor

I don't think it is an issue, you make a decision when you choose to add the block and enable or disable the option.

@Ryokuhi
Copy link
Author

Ryokuhi commented Sep 14, 2022

I see your point and agree that users are the ones who decide to add a More block and enable the "Hide the excerpt on the full content page" option.
I have reconsidered the entire issue, also in the light of how classic themes deal with it (for example, here is a comparison in the Core reference between the the_excerpt function and the <!--more--> Quicktag).

The current behavior might not be an issue with the More block itself, but it can cause problems when used with certain themes.

As pointed out, there are two different possible choices made by theme creators.

  • In Twenty Twenty-Two and Twenty Twenty-One, archive pages show excerpts. In this case, using the More block may cause interference, and part of the content might be hidden.
  • In Twenty Twenty, archive pages show the entire post content. In this case, the More block can be used freely.

Ideally, the user would know how the theme handles archive pages and may adapt the content consequently.

There are two problems, though:

  • Potentially, a theme creator might decide to use the excerpt with archive pages of certain post types and the content in others, making it very difficult for users to realize when they can use the More block and when they can't. Note: I'm not saying theme creators should do this or should be allowed to do this, but they can do it, at the moment.
  • When users switch themes, they don't know in advance if the new theme uses the excerpt or the content on archive pages: the only way to get to know this is either to switch the theme or to check its code.

As such, I still think that some improvements to the More block behavior would be useful.

In case we agree that this is not an issue with the More block itself, then we should at the very least change the description of the More block to better explain when and how to use it, but I'm worried that such a description would be quite lengthy. In case, such a discussion might continue in the issue linked above.
Another possibility would be to review default themes that show excerpts on archive pages and decide if and how to limit or disable the use of the More block, so that users wouldn't need to face the issue of "disappearing" content: with Gutenberg, this should be easier to do than with classic themes, so I think it's worth considering. The conversation on this topic would be better suited for Core Trac, as this would be an enhancement or a feature request to the existing default themes.

@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] More Affects the More Block - used for displaying the 'Read More' link [Type] Enhancement A suggestion for improvement.
3 participants