-
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
Site Editor: Add Dropdown to Create Generic Templates #26284
Conversation
Size Change: +459 B (0%) Total Size: 1.2 MB
ℹ️ View Unchanged
|
Let's try using a popover rather than a modal: Any existing templates should be hidden rather than faded out. "General" template == Clicking a template takes you to the site editor and populates the Canvas with the appropriate blocks. To determine the appropriate blocks we can hopefully reference the closest related template hierarchically. E.G. if I want to add the Page template, look first for the Singular template, then the Index template. Whichever is found is loaded as the initial state. |
@jameskoster I've updated this with I think most of your suggestions. |
Can't we use a prefix? |
Let's skip custom templates initially and focus on the supported ones. |
Shouldn't they be |
Couple of small tweaks – we can probably omit singular for now, Single + Page cover the vast majority of use cases and eliminate some potential confusion. For the template descriptions, I think we can still do some fine-tuning there. I'm inclined to say they should be literal and illustrate when they are applied. Let's use this order too: Archive Single Page Search results 404 Default (Index) |
@jameskoster I'd define Index more as Main template, applying when no other template is found. It's still considered the only file a theme needs. |
@jameskoster @mtias the "generic" templates names and descriptions are all in this file: https://github.com/WordPress/gutenberg/blob/e2d8b7a2c544d1142e7bfbbb1422a609d78e050d/packages/edit-site/src/utils/get-template-info/constants.js I think fine tuning their copy is not essential for this PR, so I'd rather have a separate one just for that. 🙂
Great question, and I don't have a good answer! |
There have been a few discussions on Slack around how to handle the somewhat confusing overlap between the singular, single, and page templates. I feel like we're very close to a decision so would invite any further feedback on the following before merging. Here are the two options that are currently being considered: FWIW My preference is option 2 as it feels more intuitive, and I can see it elegantly scaling as CPTs are registered (see 2a). Due to the ambiguous resolution and associated complexities of the single and singular templates, I think we may be able to leave them out for now, and add them later via an affordance in the UI that enables folks to add more advanced templates. That said, I am totally happy to push forward with option 1 as well. I know this is a bit in the weeds for where we are with this right now :) |
I agree with @Copons that this is not essential for this PR and can be updated in a follow up. I wouldn't consider it a blocker for merging. I also have a preference for version 2 so far. |
Both of this can be avoided for now if we disable custom template creation for the time being. I think it's better if we deal with that in a separate PR that can properly address renaming in Document Settings dropdown too. Having default templates will probably be enough to unblock initial testing. |
) | ||
) } | ||
</MenuGroup> | ||
<MenuGroup> |
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'd be fine with shipping this as an initial version after this menu group is removed.
4a909ea
to
9c1e948
Compare
I've rebased after the Nav Search feature, which brings in some button styling, and allowed me to add a "title action" container. |
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! Nice work @Copons!
Description
Part of #26270
Add a very basic interface to create generic templates from the Site Editor navigation sidebar.
Clicking on the
+
button will open a dropdown listing all missing generic templates, filling them with the hierarchically closest template content, plus a "General" template that creates a blank template.cc @jameskoster (for some reasons I can't add you to the reviewers)
Major Notes
draft
. The idea is to avoid having them immediately applied to the site, while they might still be WIP.Though, we don't have a proper way to work with draft templates (e.g. the "save" button is only "update", there is no publish flow).
$custom
templates, otherwise there might be the risk that the user accidentally creates one with a "reserved" name (e.g. "Front Page" which would be slugified intofront-page
).How has this been tested?
+
button near the Templates menu title.archive
should insert theindex
template content), and the document title shows the new template title.Screenshots
Types of changes
Checklist: