Support » Plugin: Bootstrap Blocks » Usage of blocks prevents excerpt in search results

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor tschortsch

    (@tschortsch)

    Hi @grayayer. I’ll need to look into how WordPress generates the excerpt from Gutenberg content. As a quickfix you could enable the excerpt field for pages by adding this line: add_post_type_support( 'page', 'excerpt' ); in the init action. You will then get an input field when editing a page where you can manually set an excerpt for this page. Another advantage of this solution is that you have the possibility to manually override the excerpt if there are issues with the generated one.

    Thread Starter grayayer

    (@grayayer)

    I should mention that if I just use the block columns native to WP, and apply the bootstrap column classes to these, it works just fine.

    The only difference DOM wise is that the direct child of div.entry-content is div.wp-bootstrap-blocks-row.row vs div.wp-block-columns (for native wp columns).

    I’ve tested this against the TwentyTwenty theme, and it has the problem as well. I also tried using the Advanced Bootstrap Blocks plugin, and it seems to encounter the same issue.

    Thread Starter grayayer

    (@grayayer)

    Thanks tschortsch. I appreciate the quick response. I totally get that I could enter in excerpts manually, and may end up doing that, but I want the client to be able to enter in new pages on their website without having to remember this part.

    Plugin Contributor tschortsch

    (@tschortsch)

    Ok I just found the excerpt_remove_blocks() function in the WordPress core. It looks like we need to filter out our row and container blocks that they’re not removed from the excerpt.
    I’ll try to implement this for the next version of this plugin. Thanks a lot for your investigation! I’ll keep you updated.

    Thread Starter grayayer

    (@grayayer)

    Awesome work. I am super impressed with your responsiveness here. At your suggestion for the particular site, I’ve added manual excerpts as a patch in the meantime.

    Plugin Contributor tschortsch

    (@tschortsch)

    I looked a little bit more into this issue and sadly it seems that it’s not possible to enable excerpt generation for custom blocks which use the InnerBlocks feature (like our row and container block).
    The core/columns block is the only block which has this possibility right now since this is hardcoded into the WordPress core (see: https://github.com/WordPress/WordPress/blob/master/wp-includes/blocks.php#L600). There is the following Trac ticket which addresses exactly this: https://core.trac.wordpress.org/ticket/47637. But it looks like that this feature doesn’t seem to land anytime soon in core (at least not in WordPress 5.5). I will close this issue for now and wait for an update in the Trac ticket.

    Thread Starter grayayer

    (@grayayer)

    So good to have a definitive answer on this. Thanks for doing the research. I’ll cross my fingers that it lands sometime.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Usage of blocks prevents excerpt in search results’ is closed to new replies.