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

Site Editing: Allow template edits to be saved as a new template #27851

Closed
jameskoster opened this issue Dec 21, 2020 · 6 comments
Closed

Site Editing: Allow template edits to be saved as a new template #27851

jameskoster opened this issue Dec 21, 2020 · 6 comments
Labels
Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts.

Comments

@jameskoster
Copy link
Contributor

When editing a template there are three ways in which those edits can be saved, and the UI should provide an affordance for users to select their preference. To remove any doubt or confusion, this should ideally be possible before engaging the multi-entity-saving flow.

The simplest and most obvious method is to simply update the current template and overwrite the previous version. Just like when you edit a post or page. This would likely be the default selection in most cases.

The second method is to create a new template with greater specificity. That is to say, if I am editing the page template, it should be possible for me to create a new page-$id template.

The third method is to create a new generic template that can be applied to any post or page. The equivalent in traditional theme building would be a $custom.php template.

@jameskoster
Copy link
Contributor Author

Assuming we implement a "Template" tab in the inspector when editing templates (#27470), I believe that would be a good place to house these options.

The following design could be a simple way to cater the first two save methods which are probably the higher priority:

Screenshot 2021-01-25 at 15 40 37

It would be easy enough to expand this to accommodate custom templates as well.

@annezazu
Copy link
Contributor

As part of the sixth call for testing for the FSE Outreach Program, some feedback came in from @bobbingwide that I wanted to pass along here as designs are explored going forward. Keep in mind that this is referring to the Template Editing Mode experience and not the Site Editor but the same desired functionality applies to both experiences:

When I first created a new custom template I was surprised by its content. I’d become used to the Site editor copying the index template. While performing this test I thought, “Why can’t I pick the template upon which my new template should be modelled?” It makes sense to be able to use a template as a template. This would be a nice feature.

This is essentially what's available with Google docs where you can copy a current document and then customize the copy to your liking. It ends up saving time especially if you have a "base" template you really like.

@jameskoster
Copy link
Contributor Author

Thanks @annezazu, having thought about this a little more I'm not sure how useful it would be in practical terms. If you're creating a new template for a post or page (currently all that is possible in the UI), then there will only be so many existing templates you can use as a base. Most of them – things like 404, archive, search – will not be suitable. Overall this flow (essentially duplicating a template agnostic of any particular post/page) feels like something that might be better suited to the Mosaic view.

Using the index.html as a default for all new template is something we could potentially explore in a separate issue :D This would of course only be possible for block themes.

@jameskoster
Copy link
Contributor Author

Whatever we come up with for Reusable Blocks (#35113) can likely be reused for templates / template parts.

@mtias
Copy link
Member

mtias commented May 23, 2022

@jameskoster I think this has some similarities with the flow for creating a new template for a specific category / post type, maybe it could share some design familiarity.

@jameskoster
Copy link
Contributor Author

Yes there is some overlap with that flow.

On reflection I'm not sure how important this affordance is. It essentially allows you to duplicate the current template whilst editing it, and add specificity. I'm not convinced that's something you'd do whilst editing the template. As I said above (almost a year to the day :D) it seems like an exercise better suited to the template list.

Once #41060 and #41189 are closed it will be possible to create specific templates (e.g. category-$slug), and as a part of that flow select a starting point (blank, closest hierarchical template, pattern). This is essentially doing the same job as this issue, via a more intuitive interface (imo).

We can potentially revisit a dedicated duplication flow for templates in the future, but I'm not sure we need it. Some templates cannot be duplicated (e.g. 404) which complicates things, and when duplication is possible the pathway described above already does the same job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts.
Projects
None yet
Development

No branches or pull requests

3 participants