-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
This idea was discussed in person at WCEU 2022 during contributor day: @youknowriad @aristath @gziolo @luisherranz
Connecting schemas (https://schema.org/docs/schemas.html) with blocks is something that has been surfaced a few times in the past as an interesting use case. There are several plugins doing that already by creating custom blocks. This proposal aims at introducing a slight twist to it, making schemas central to patterns, not specific blocks.
The idea would to add a very thin layer of support for itemscope itemtype
to container blocks (namely Group
), so you can connect a wrapper to a specific schema (such as https://schema.org/Recipe
) with the cascading effect of unlocking specific itemprop
fields in all the children of the group. Notably, the child blocks don't need to be of any specific block type, so you can use regular paragraphs, headings, images, and so on.
The itemprop
would be accessed in the Advanced panel of the child blocks, ideally through a selector that exposes only the itemprops supported by the selected schema of the parent. During publication, we can develop a validation step where we'll warn users if anything might be missing to conform to the schema. This would allow the easy creation, publication, and sharing of patterns with a semantic layer, without needing to create custom block type to support them.
An initial release doesn't need to do any fetching, validating, nor dynamic selectors, and can focus instead on supporting the underlying attributes once a schema is defined in a parent context. In the future, when going through the flow of creating a new pattern in the patterns directory, we can allow using a schema as a starting point. That would generate a set of basic blocks already connected to the relevant itemprops
so the pattern builder would only need to arrange, remove, and customize the appearance before publishing a feature reach pattern.