Skip to content

Fix: Excerpt Block ignores list#68916

Open
dhananjaykuber wants to merge 1 commit intoWordPress:trunkfrom
dhananjaykuber:fix/excerpt-block-ignores-list
Open

Fix: Excerpt Block ignores list#68916
dhananjaykuber wants to merge 1 commit intoWordPress:trunkfrom
dhananjaykuber:fix/excerpt-block-ignores-list

Conversation

@dhananjaykuber
Copy link
Copy Markdown
Contributor

Fixes #55562

What?

Modifies the Post Excerpt Block's editor component to properly handle and display list content when generating excerpts. Previously, content in list items was being ignored in the excerpt generation.

How?

  • Processing list items before plain text conversion

Testing Instructions

  1. Create a new post
  2. Add a list as the first content
  3. Add some paragraph text after the list
  4. Create a new page
  5. Add a Post Excerpt block
  6. Select your test post
  7. Verify that the list items now appear in the excerpt

Screenshots or screencast

Before

Screenshot 2025-01-28 at 3 02 37 PM

After

Screenshot 2025-01-28 at 3 02 58 PM

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 28, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dhananjaykuber <dhananjaykuber@git.wordpress.org>
Co-authored-by: hanneslsm <hanneslsm@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: jordesign <jordesign@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@hanneslsm
Copy link
Copy Markdown

Thank you for working on this!

@hanneslsm
Copy link
Copy Markdown

hanneslsm commented Jan 28, 2025

I wonder if we should include a option to the excerpt block saying "include lists" (default false).
The change in this PR could break current websites who rely on lists not being displayed in the excerpt.

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Block] List Affects the List Block labels Jan 31, 2025
@t-hamano
Copy link
Copy Markdown
Contributor

Instead of changing the behavior of a specific block, I think we need to fix the underlying problem.

That is, the problem with the excerpt_remove_blocks() function excluding lists. I have submitted a core ticket and patch for this issue. The cause of the problem can be found there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] List Affects the List Block [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Excerpt Block ignores list

3 participants