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

Change excerpt length in post excerpt block #34757

Closed
getdave opened this issue Sep 11, 2021 · 24 comments · Fixed by #44964
Closed

Change excerpt length in post excerpt block #34757

getdave opened this issue Sep 11, 2021 · 24 comments · Fixed by #44964
Assignees
Labels
[Block] Post Excerpt Affects the Post Excerpt Block Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@getdave
Copy link
Contributor

getdave commented Sep 11, 2021

What problem does this address?

When listing out a set of posts a post-excerpt block is displayed. However there is no option to control the length of the text that is displayed.

What is your proposed solution?

Provide a UI control to control the length of the excerpt.

@getdave getdave added the [Block] Post Excerpt Affects the Post Excerpt Block label Sep 11, 2021
@mtias
Copy link
Member

mtias commented Sep 13, 2021

For reference, the Latest Post block allows setting excerpt length:

image

@mtias mtias added the [Type] Task Issues or PRs that have been broken down into an individual action to take label Sep 13, 2021
@ntsekouras
Copy link
Contributor

This is a related PR: #33366 that removed for now this field, and I explain the inconsistencies with this field.

In a few words excerpt_length filter is used only when an excerpt is not explicitly set, so if we want to be consistent we need to trim the returned content with wordCount attributes and also somehow find the value in js and handle the excerpt_more filter.

@dingo-d
Copy link
Member

dingo-d commented Dec 30, 2021

Will the read more length of the excerpt block be returned in WP 5.9 or GB plugin 12.3?

@carolinan
Copy link
Contributor

@dingo-d I don't see a pull request for solving the issue, so I don't think it will be solved in time.

@cadop
Copy link

cadop commented Feb 12, 2022

Please consider fixing this

@getdave getdave added the Needs Dev Ready for, and needs developer efforts label Feb 14, 2022
@annezazu
Copy link
Contributor

This was mentioned in the latest FSE Outreach Program call for testing:

The Post Excerpt block under the Query Loop doesn’t have an option to adjust the excerpt length. (The Latest Posts block does have this option.)

It does feel odd that the controls exist in the Latest Posts block but not here. When thinking about expanding functionality, this seems like a high impact quick win.

@ellenbauer
Copy link

It does feel odd that the controls exist in the Latest Posts block but not here.

So true, I also think consistency between blocks is missing here. I heard that it might not be so easy to add Excerpt length settings to the block. But from a theme author's side, this seems to be something we would have loved to have solved in WordPress for so many years. Therefore, it would be amazing to have a solution for this issue.

@annezazu
Copy link
Contributor

annezazu commented Jul 4, 2022

@scruffian might this fit as being under general block support work? #41113

@BrunoAHVincent
Copy link

Any updates on this, I'm trying to add excerpt text to dynamic header, and needs to be very short

@mtias
Copy link
Member

mtias commented Sep 10, 2022

@ntsekouras can we revisit this and try to find a more straightforward solution? I'm not sure what consistency you are referring to with wordcount, but it seems like a minor concern compared to the ability to control length when setting up a design.

@paaljoachim
Copy link
Contributor

I noticed this missing as I am exploring Twenty Twenty Two for a site with a lot of written material. I am hoping it can be added soon. Thanks!

@carolinan carolinan self-assigned this Oct 14, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Oct 14, 2022
@richtabor
Copy link
Member

Dropping a note that this would be pretty useful in improving the query block.

@carolinan
Copy link
Contributor

carolinan commented Nov 18, 2022

Any help in moving it forward would be appreciated. I have not been able to reliably determine if an excerpt is generated automatically vs created by the user.

  • When the excerpt is created by the user, the length limitation needs to be removed, otherwise their entered text will not show.
  • It seems that once a post is saved, the excerpt is saved as if it is user generated, regardless if it has been edited or not?

@mtias
Copy link
Member

mtias commented Nov 18, 2022

I feel trimming the text should be unrelated to whether the text is crafted by the user or pulled from the content. There could be instances were a user crafted excerpt works well in one query view, but there's another more condensed sidebar display that wants to show a single line, even if it's user generated.

@carolinan
Copy link
Contributor

Perhaps then the length option should only be available when in the site editor or inside a query.

@richtabor
Copy link
Member

I feel trimming the text should be unrelated to whether the text is crafted by the user or pulled from the content.

Agreed.

@carolinan
Copy link
Contributor

It is now implemented in the PR. But it is the opposite of how the excerpt length filter works in WP Core.

@annezazu
Copy link
Contributor

annezazu commented Dec 19, 2022

Noting that this was brought up in the nineteenth call for testing for the FSE Outreach program as desired. Let me know if I can help at all in moving this work forward (bring in reviews, etc).

@carolinan
Copy link
Contributor

I need help with including @WordPress/wordcount in block-library, I don't think I did it correctly (I did not push an updated lock file).
It needs a new accessibility review after the recent updates: #44964 (comment)
And general code and usability reviews.

@annezazu
Copy link
Contributor

Thank you!

@alexstine do you think you could provide an accessibility review?
@getdave could you help with including @WordPress/wordcount in block-library as well as perhaps provide a code review?

I'll work on a usability review and will leave some notes as I have them on the PR.

@alexstine
Copy link
Contributor

@annezazu Sure. I will try to take a look soon.

@waqastariqkhan
Copy link

waqastariqkhan commented Mar 21, 2023

Hi everyone, here

on line 80, there is this comment:

_* If themes or plugins filter the excerpt_length, we need to

  • override the filter in the editor, otherwise
  • the excerpt length block setting has no effect.
  • Returns 100 because 100 is the max length in the setting._

Shouldn't excerpt_length hook defined here alter the length of the excerpt block?

I tried using it but it seems to have no effect, or am I missing something?

Thanks

@carolinan
Copy link
Contributor

Hi
The filter should not affect the block because it would override the block setting.

@carolinan
Copy link
Contributor

I would like to suggest that, if there are more feature requests, enhancements or bug reports for this block please open new issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Excerpt Affects the Post Excerpt Block Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

Successfully merging a pull request may close this issue.