[Resolved] Excerpt blank for some GenerateBlocks combinations

Home Forums Support [Resolved] Excerpt blank for some GenerateBlocks combinations

Home Forums Support Excerpt blank for some GenerateBlocks combinations

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1289683
    Natalie

    If your page starts with a GenerateBlocks grid, nested containers, or a headline inside a container then the excerpt that WordPress auto-generates is blank. I noticed this issue on the search results page where a lot of my excerpts were blank.
    Some of my pages have nested containers

    I have looked at the WP (and GB) code and can see why this is happening.

    WP only allows certain types of blocks when parsing the page trying to extract an excerpt.

    GB has defined the container and headline blocks as ‘allowed’ blocks for their contents to be used in the excerpt.

    BUT if the container or headline block are ‘inner’ blocks – i.e. they are inside another block (e.g. a container), then WP will not parse them when constructing the excerpt.

    This is because the list of ‘inner’ blocks that WordPress will parse is fixed and cannot be modified by a plugin (WP has no filter for the list)

    So GB is unable to tell WordPress that container and headline blocks are allowed ‘inner’ blocks.

    WP are aware of this issue (and have been for 11 months!) and other block plugin authors have the same problem.
    ref: https://core.trac.wordpress.org/ticket/47637

    Tom – I’m sure you’re aware of this, and presumably there is no workaround at the moment.

    I’m posting here to help others with the same issue, so they don’t spend a whole day trying to work out why some of their excerpts are blank!

    I’m trying to rethink my page structure to avoid nested containers, but you can’t really control what a client will add to the page, so my best solution at the moment is to manually define an excerpt for the page.

    To do that you need to enable the Excerpt box for pages in functions.php:
    add_post_type_support( 'page', 'excerpt' );

    #1290655
    Tom
    Lead Developer
    Lead Developer

    Hi Natalie,

    Thanks for posting this! We are aware, and as you found I did my best to at least include basic containers/headlines in the excerpt.

    I think the manual excerpt method is the best way forward for now until Gutenberg figures it out.

    Thanks again!

    #1291009
    Natalie

    Thanks

    #1321454
    Tom
    Lead Developer
    Lead Developer

    Just circling back on this. It’s a WP issue that needs to be addressed: https://core.trac.wordpress.org/ticket/47637

    #2302630
    Joey

    I’m posting here to help others with the same issue, so they don’t spend a whole day trying to work out why some of their excerpts are blank

    So I spent about a day trying to figure this out, haha I came to the same solution. I wish I would have seen this post first. But apparently it’s still a WP issue in 2022.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.