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

Post editor: Template panel should adapt when explicit template exists #41452

Open
Tracked by #41241
jameskoster opened this issue May 31, 2022 · 7 comments
Open
Tracked by #41241
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor [Type] Bug An existing feature does not function as intended [Type] Enhancement A suggestion for improvement.

Comments

@jameskoster
Copy link
Contributor

jameskoster commented May 31, 2022

Follow up to #41189.

When a template exists that automatically resolves to display a specific post or page (e.g. single-post-$slug), the Template panel in the post editor will need some adjustments when editing the corresponding post:

  • It should not be possible to create a new template – this is misleading as it suggests the new template could be applied to the current post.
  • The template dropdown should be hidden since it isn't possible to change the template.
  • Some text explaining the above could eliminate potential confusion.
  • We might consider adding a way to delete the explicit template.

Screenshot 2022-05-31 at 10 51 02

If we added a delete action it should invoke a confirmation modal that explains which template will be used after deletion.

Edit: To clarify, the explicit template is only applied automatically if a $custom template has not been applied previously. So the UI above should only be presented when no $custom templates exist at all.

@jameskoster jameskoster added [Type] Enhancement A suggestion for improvement. [Feature] Template Editing Mode Related to the template editor available in the Block Editor labels May 31, 2022
@jameskoster
Copy link
Contributor Author

This pretty much feels like a bug at the moment.

After creating a template for a specific post I can actually change which template is applied when editing that post, which undermines the specific template logic altogether.

@jameskoster jameskoster added the [Type] Bug An existing feature does not function as intended label Jun 24, 2022
@carolinan carolinan self-assigned this Jun 29, 2022
@carolinan
Copy link
Contributor

I tried to solve this in components> sidebar > post-template but I got stuck because the template slug is not defined for the "Default" template:
I am not sure how to differentiate single.html from single-post-$slug.html, because they would both have no template slug value and both would be valid defaults? The options should only change if single-post-$slug.html is available.

@carolinan carolinan removed their assignment Jun 29, 2022
@jameskoster
Copy link
Contributor Author

@noisysocks has been working with the template panel recently, perhaps it's something he can look into? 🙏

@noisysocks
Copy link
Member

What happens if the post already has a template that was created using the post editor sidebar?

@jameskoster
Copy link
Contributor Author

That is a very good question, and I am once again humbled by the template hierarchy 🙈

Currently templates created in the post editor are $custom and therefore above specific templates (such as single-post-hello-world) in the hierarchy. I mistakenly thought it was the other way around.

So actually the current behavior of the template panel is correct – I am able to select a $custom template, or the template that was created for that specific post.

The flow of creating a template for a specific post and not applying it feels a bit strange, but that's something to explore separately. I'll close this issue.

@noisysocks
Copy link
Member

It's definitely confusing 😅 I don't really like that we have two flows to accomplish what amounts to the same thing.

@jameskoster
Copy link
Contributor Author

Turns out the explicit template is applied automatically, but only when a custom template hasn't been applied. Re-opening and updating the OP :D

@jameskoster jameskoster reopened this Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor [Type] Bug An existing feature does not function as intended [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants