-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Docs: Add description for templateParts
in theme json.
#30118
Conversation
Size Change: +9.4 kB (+1%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Addison-Stavlo !
Something that I'm not sure myself is: do we need to declare all created Template parts in theme.json or we have to, only if we want to utilize the Block variations API?
@@ -464,6 +464,19 @@ There's a growing need to add more theme metadata to the theme.json. This sectio | |||
} | |||
``` | |||
|
|||
**templateParts**: within this field themes can list the template parts present in the `block-template-parts` folder. For example, for a template part named `my-template-part.html`, the `theme.json` can declare what area that template part is intended for to use the corresponding block variation in the editor. Currently block variations exist for "header" and "footer" values of the area term, any other values and undefined template parts will default to the general template part block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it needs a bit more clarification about why this has to be set here (theme.json
) and not as an attribute in the markup. Maybe something like this:
the Template part block renders its own entity internally. Any attributes on the outer block itself are just block attributes, and thus saved as part of the post it is a child of (template, page, etc).
- you have written this :).
Also a bit more info about what a match with a block variation means (results), like the proper display information and where else will be used for (semantic).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to declare all created Template parts in theme.json or we have to, only if we want to utilize the Block variations API?
We don't have to declare them, as they would default to the general/uncategorized area. Thats part of what I was getting at with:
undefined template parts will default to the general template part block.
I think it needs a bit more clarification about why this has to be set here (theme.json) and not as an attribute in the markup.
I was trying to keep it light, describing what needs to be done and how to do it without adding all the weight of internal database structures, entities, taxonomy terms, etc. etc. Im happy to add more if people think it is necessary, but I was trying to avoid making the description a bit too heavy and confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and not as an attribute in the markup.
Thinking about it more, especially since we recently added that 'area' attribute used in placeholder/creation flows it probably makes sense to clarify that here. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated a bit 😁
templateParts
in theme json.templateParts
in theme json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the first passage I got confused about why the term "block variation" was used, but it was made clearer when I continued reading.
Thanks for taking a look @carolinan!
Im glad it became more clear. I pushed a minor update to try and improve clarity, hopefully that is slightly better. 😁 If you have any other suggestions I am happy to hear them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Description
Updates theme json docs to include schema for definine template part areas.
How has this been tested?
Screenshots
Types of changes
Checklist: