-
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
Semantic Template Parts #27337
Comments
Couple of other UX options:
|
Potentially useful for providing consistent semantic class names for styling. |
It seems we'd need to work through something like a term set that we can maintain and augment, starting with header and footer. These should probably be exposed in the inspector for a template part so the user can specify if a template part they created is a header, etc. |
The term set makes sense to me. Should a theme be able to supply more than 1 of these terms for a template part? If not, we can use the I wonder if we should also:
Also, when inserting a template part that has multiple items in the term set - how should we go about deciding which to use as the default |
Are you asking whether a theme should be able to specify that a template part is both a Header and a Footer? I hadn't considered that yet but can definitely see a use case. It would be convenient to not have to duplicate a template part if you want the site header and footer to be identical. The usefulness evaporates somewhat when you think about the other categories though... I'm struggling to think of a situation where a template part for displaying content could also be used as a header, or a sidebar... it'd be good to get some input from themers here I think cc @kjellr.
I think so, yes. Considering some of the other work we have planned around template parts, it seems unlikely that users will ever insert a "Template Part" block. Instead they'd insert their "Header with large logo" or "Header with small logo" block. These are template parts under the hood, but more intuitively named and accessed. |
Yeah. More specifically my comments above are trying to make sure I understand @mtias comment about the "term set that we can maintain and augment". To me 'term set' means it can contain multiple items. So does that mean a specific template part contains a 'term set' and can be associated in multiple ways as you note above, or does that mean we have a 'term set' of available types and any given template part may only be associated with one of those terms at a time? |
I anticipate the latter, at least to begin with. The former feels to me like something we could consider adding after we've explored the use cases further and got more input from themers. |
Since template parts can really be anything, I think there's value to allowing flexibility here. Maybe you have an |
To clarify the intention here: my expectation is that there will only ever be one header, one footer, and so forth when it comes to template parts. With "term set" I just mean the list of viable terms we'd support like for post formats, not that you could have more than one applied. It's somewhat equivalent to Patterns can always be categorized as pertaining to both headers and footers if the design makes sense. Template parts are already very flexible and loose, so I'd suggest starting very simple with these (only header and footer to start with). |
Wouldn't template part specific block patterns be extra steps and more complicated? Compare the following: The theme offers 3 header designs in 3 different header template parts. and: The theme offers 3 header designs in 3 different block patterns and one header template part. The theme author would choose between providing extra HTML files or registering block patterns and block pattern categories. |
If there is only a single Header template part, how would I configure a unique header design for Granted I could open the Page template, delete the Header and insert a pattern at the root level. But doesn't that kind of undermine the point of template parts? There is a lot of conceptual overlap between patterns and template parts, but I am not sure we can escape template part variations. Especially if we want to support things like |
I believe there is just some terminology confusion... |
@jameskoster another thing to take into account is how we surface these in the W menu for the current template. |
IMO the W menu is a more agnostic navigation tool and probably shouldn't highlight anything template-specific – it should always behave the same regardless of which template is being edited. That said, there are several other locations we can surface parts relevant to the current template:
|
Yes, thinking more about it I think we need to make better use of the template dropdown and template inspector instead. |
Now that template parts have their area terms and corresponding variations applied (giving context for patterns, semantic html elements, searching other like entities, etc.), I am wondering if we should close this issue? Or leave it open for further discussion on more ways to leverage these classifications? |
Theme switching is one area that is still not fully explored, but we can do that separately. |
Once a subset of template parts start to be defined (#26599), it'll open up the doors for some work we have hinted at before.
header
. The creation flow of a template part that is marked as a header can be optimized for that specific flow, allowing users to choose from different global headers. Themes could also supply a few variations of their header, ensuring they only show up for the header template part and not as regular patterns.<header>
. We could also warn if a header doesn't contain a site title, or if the site title is not set to using h1. Knowing template regions is also highly valuable for naturally including elements like FSE: Add skip link #21507 (root or header).Any other ideas where we can leverage the added knowledge of semantic template parts in the editor?
The text was updated successfully, but these errors were encountered: