-
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
Template editing: convert semantic patterns to template parts upon insertion #41397
Comments
I don't know that you always want to make these synchronized by default. If pursuing this, we should probably ask for semantic patterns, and only if you don't already have a header / footer saved. |
I think this is definitely a necessary improvement. Especially considering the quick inserter's current functionality when you search "Header" you end up with only patterns suggested (since block results are prioritized after patterns), and selecting one just drops blocks directly onto the template. not only do users miss out on:
But they also miss out on the semantic template part functionality of automatically having a semantic Something like @jameskoster's mockup to present an option when inserting one of these patterns definitely seems useful! Although also note it would be smart to bypass presenting this option if the insertion point is already inside a template part. |
Noting that patterns should probably be converted to template parts during the replacement flow as well. Or we should ask the user how they'd like to proceed (update current template part or create new). At the moment, if you replace a template part, and select a pattern from the resulting modal, that pattern gets inserted into the current template part. This is obviously an edit, not a replacement. Video demo: tp.mp4 |
I'm not sure if there are already other ideas for solving this, but I had a potential idea. The template part block could declare a new type of block transform for patterns. Whenever a pattern that has a The only downside is that this transform is probably only going to be useful for template parts, I can't think of any other use cases. But at least it's an existing system rather than inventing something completely new. Another option could be to actually define a template part within the pattern itself (similar to how the navigation block works in that it can have serialized inner blocks), but that seems problematic given there are so many existing patterns in the wild, they'd all need to be updated. |
@talldan also related, we have discussed pattern transforms in a few places: #27575, #28737, #38529. The core idea being that we can have "pattern variations" defined as set of patterns that loosely have the same overall blocks and map attributes of role=content. It wasn't clear how we'd define these variations in a way that doesn't create too much API overhead. One thing I proposed at some point was using We need to bring this to places other than header and footers, so a user can cycle through some variations of a Hero pattern without being inundated with an entire category worth of patterns. cc @mcsf |
Thanks for those links. A lot of interesting discussions that I wasn't entirely aware of. 👍 My comment above was mostly about finding a way to codify the creation of an entity for template part patterns. I think that's still a valid issue (and possibly for the navigation block too). At the moment this is only surfaced in specific flows within those blocks.
Yeah, this is interesting. A good example is a set of blocks that might have an image, where a pattern incorporating a cover could be an appropriate substitute. It isn't clear to me how using It feels like there's some crossover with the concept of microformats as well. Going deeper down the rabbit hole, how would patterns showing events be surfaced if the blocks involved are mostly groups, post titles and post dates. Though maybe that's being a bit too clever—a user can always search. |
This came up as part of the FSE Outreach Program's Build a Block Theme exploration. In particular, here's a link to a video where @paaljoachim very kindly walks through his thought process of adding a new header pattern and trying to have it "takeover" as the header template part: https://youtu.be/tniEqn9q0fk?t=1344 It runs for about a minute until moving on to other issues.
|
Thanks Anne! What if Patterns are actually just another option like Row, Stack, Grid etc in a Group block. |
Closing this as it is essentially captured by #48458. Specifically: the ability to update the sync status of a pattern. |
Potentially part of #41379.
On occasions where patterns designed to be used for template headers / footers are inserted it might be good to automatically create template parts, or at least offer a way to do so. This helps in a couple of ways:
A very rough mockup:
create.footer.mp4
To do:
The text was updated successfully, but these errors were encountered: