Wordpress-seo: [BUG] Block schema doesn't output when block is nested within other blocks

Created on 30 Sep 2019  ยท  19Comments  ยท  Source: Yoast/wordpress-seo

Please give us a description of what happened.

Our FAQ and HowTo schema doesn't output when the FAQ or HowTo block is nested within another block (e.g., in a Columns or Cover block).

NB: When testing with the Gutenberg 6.5 plugin, also applies to Group blocks.

Please describe what you expected to happen and why.

Our schema logic should trigger whenever the relevant blocks are in the page; not just when they're at the top-level of the page content.

How can we reproduce this behavior?

  1. Add a Group, Columns or Section block to a new post.
  2. Add a HowTo or FAQ block within that block.
  3. View the source code; note that the HowTo/FAQ schema is missing from the graph.

Technical info

  • If relevant, which editor is affected (or editors):
  • [ ] Classic Editor
  • [x] Gutenberg
  • [ ] Classic Editor plugin


* Which browser is affected (or browsers):
- [x] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Other

Used versions

  • WordPress version: 5.2.3
  • Yoast SEO version: 12.1
  • Relevant plugins in case of a bug: N/A
  • Tested with theme: Twenty Nineteen
Schema gutenberg schema (JSON+LD) minor

Most helpful comment

Assumption is correct. We're currently only looping over the unnested blocks.

Would be fairly simple to recursively loop over inner blocks.

This loop: https://github.com/Yoast/wordpress-seo/blob/trunk/frontend/schema/class-schema.php#L188

Should be moved to it's own function which recursively calls itself with $block->innerBlocks if they've been set for each block.

All 19 comments

My assumption is that our parsing only skims the top-level structure of the page content, rather than traversing the whole structure. Likely needs some architectural consideration (e.g., do we want to whitelist block types for traversal, or just consume _everything_)?

Assumption is correct. We're currently only looping over the unnested blocks.

Would be fairly simple to recursively loop over inner blocks.

This loop: https://github.com/Yoast/wordpress-seo/blob/trunk/frontend/schema/class-schema.php#L188

Should be moved to it's own function which recursively calls itself with $block->innerBlocks if they've been set for each block.

I just ran into this as well where when creating a page with Atomic Blocks and sticking the FAQ in the AB Advanced Column the schema output was not being generated.

Please inform the customer of conversation # 568926 when this conversation has been closed.

Hi team. Any update on this bug? Alternatively, can you suggest a workaround to fire this schema mark-up?

It looks like this will be fixed with the release of the indexables feature. Release date is unknown though.

Team - Is this fixed now? Just saw this in email from Yoast:

Schema in Yoast SEO

_Earlier this week, we launched Yoast SEO 12.8. This release featured a number of bug fixes and performance enhancements. One of the additions was an improvement to the way developers can hook into our elaborate Schema structured data implementation. This makes it easier to get your site-specific Schema inside the structured data generated by Yoast SEO. Our state-of-the-art Schema implementation โ€” including the FAQ and How-to content blocks โ€” is freely available for all users of Yoast SEO.

We just installed 12.8 and still not fixed.

Team - Any progress on this? I'm getting desperate. Please... ๐Ÿ™๐Ÿ™๐Ÿ™

Can confirm this is still an issue in 13.1.

Please inform the customer of conversation # 590670 when this conversation has been closed.

I can also confirm that this is still an issue in Yoast V13.2 and WP 5.3.2, I hope you guys can fix this soon.

Fixed in 13.3? Anyone tested it?

@jonnycorlett just tested it on my site and it is not yet fixed.

I'm also facing this problem; 13.3, not fixed

It's fixed! Rich results now showing...

https://search.google.com/test/rich-results?id=30o29Z2aDEMUH7fw1GWYiA
https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fwebadmin.arlo.co%2Fstructured-in-a-container

Confirmed to be fixed on 14.0+. Closing.

Thanks for fixing it!

Was this page helpful?
0 / 5 - 0 ratings