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

Specify which blocks to populate a new template with #32211

Closed
jffng opened this issue May 25, 2021 · 6 comments · Fixed by #32771
Closed

Specify which blocks to populate a new template with #32211

jffng opened this issue May 25, 2021 · 6 comments · Fixed by #32771
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor

Comments

@jffng
Copy link
Contributor

jffng commented May 25, 2021

This issue relates to the recently introduced template creation / editing feature.

When I go to create a new template, the template appears to auto-populates with the following blocks:

  • Site title
  • Site tagline
  • Separator
  • Post Title
  • Post Content

Example screenshot with emptytheme:

Screen Shot 2021-05-25 at 12 06 37 PM

Are the default blocks to populate a new template being considered? What default makes sense?

Some thoughts / options from a theme developer perspective:

a) singular falling back to index
b) entirely blank
c) give the theme a way to specify

@jffng jffng added the [Feature] Template Editing Mode Related to the template editor available in the Block Editor label May 25, 2021
@justintadlock
Copy link
Contributor

There should probably be a hierarchy:

  1. Let themes define a blank/starter template.
  2. If no theme-defined template, fall back to single/page/singular template.
  3. If no single* templates, fall back to index template.

@jffng
Copy link
Contributor Author

jffng commented May 25, 2021

That hierarchy makes sense to me.

The UI could also be refined to make it clear what the source template is, or allow the user to select / change it.

@bobbingwide
Copy link
Contributor

bobbingwide commented Jun 11, 2021

In my response to an FSE outreach call #6 I wrote

I think I’ve made this comment before. 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.

https://sneak-peek.me/2021/05/23/call-6-template-editing-and-navigation-block/#more-429

The Create new template dialog would be:

Create new template
Name: text field 
Based on: select from a drop down list of existing templates
Create button  Cancel button

An additional benefit of cloning an existing template is that the attributes of the template-parts used in the template would be copied. I noted, during call #7, that I needed to (re)define the attributes for each existing template part when I was building the new template.

@justintadlock
Copy link
Contributor

Cloning an existing block template is a good idea. With block themes, users can select and edit an existing template, but there's no way to give it a new slug (AFAIK).

For 5.8 and non-block themes, I don't think there'd be a good way to do that since they are built on PHP. But, for block templates, I'd love to see that as an option.

@fklein-lu
Copy link
Contributor

For 5.8 and non-block themes, I don't think there'd be a good way to do that since they are built on PHP.

PHP themes should be able to provide a template without needing to add a block-based template.

It will be impossible to transition most PHP themes to being block-based while keeping the same design and functionality. So you can't expact authors to add single.html or page.html templates as they would be used for content rendering.

But authors still would want to offer something better than the current default template, which looks very poor. Even if authors can't offer a template that looks exactly like the PHP templates, they can at least offer something a bit more styled.

I'm very surprised that the default template is hardcoded without even the slightest possibility to change this through any mean whatsoever.

@aristath
Copy link
Member

Linked this issue to #32771 which adds a way to define the default templates. When that PR gets merged this one can be closed 👍

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants