Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add semantic patterns documentation #38778

Merged
merged 2 commits into from
Feb 14, 2022
Merged

Add semantic patterns documentation #38778

merged 2 commits into from
Feb 14, 2022

Conversation

youknowriad
Copy link
Contributor

related #28737

While I try to work on #28737 I noticed that we actually already support these kind of semantic patterns but that it was not documented properly.

It was not easy to come with the right wording here. So please happy to take on suggestions.

@youknowriad youknowriad added [Type] Developer Documentation Documentation for developers [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Feb 14, 2022
@youknowriad youknowriad self-assigned this Feb 14, 2022
Copy link
Contributor

@ryanwelcher ryanwelcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added a small change

docs/reference-guides/block-api/block-patterns.md Outdated Show resolved Hide resolved
Co-authored-by: Ryan Welcher <ryan.welcher@automattic.com>
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! It needs to be better advertised . There is also something with attributes where you can mark their role as content in case you want to inject that into the pattern. @ntsekouras might know better if that applies here.

@youknowriad youknowriad merged commit 62cf9f7 into trunk Feb 14, 2022
@youknowriad youknowriad deleted the add/doc-patterns branch February 14, 2022 16:58
@github-actions github-actions bot added this to the Gutenberg 12.7 milestone Feb 14, 2022
@youknowriad
Copy link
Contributor Author

Good call @gziolo Yeah, the role is indeed related. It's still experimental though, so let's wait a bit before adding that information.

'categories' => array( 'header' ),
// Assigning the pattern the "header" area.
'blockTypes' => array( 'core/template-part/header' ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth noting that core/template-part/header is something that is used only by template parts and is not a generic API for block variations. It had been discussed to support block variations with the same format, but eventually left for template parts to override the filtering patterns function with that naming convention.

@ntsekouras
Copy link
Contributor

I created a follow up for this one here: #38809, if you think it brings some value 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants