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 Editor: 'page-home' template is categorized as a 'General' template #30454

Closed
Sandstromer opened this issue Apr 1, 2021 · 5 comments
Closed
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing")

Comments

@Sandstromer
Copy link

Sandstromer commented Apr 1, 2021

Description

The TT1 Blocks theme has one additional custom page template - 'page-home.html'
In the Site Editor > page templates side navigation panel, the 'page-home' template is grouped under the 'General templates' sub-panel.

Step-by-step reproduction instructions

  1. Go to 'Site Editor'
  2. Select 'Browse all templates'
  3. In the side nav panel, go to 'Templates' > 'General templates'
  4. Notice how the 'page-home' template is available to select in the 'General templates' section.
  5. Rename the 'page-home.html' template to something else e.g. 'page-home-one.html' or 'page-bob.html' etc
  6. Back in Site Editor, notice how the renamed template is now correctly grouped in the 'Page templates' section.

Expected behaviour

Custom page templates should be grouped in 'Page templates'

Actual behaviour

A custom page template with the file name 'page-home.html' is grouped in 'General templates'
I tested with variations of the file name and creating additional page templates, and the only time a custom page template is not grouped in 'Page templates' is when it is specifically named 'page-home.html'

Screenshots or screen recording (optional)

Code snippet (optional)

WordPress information

  • WordPress version: 5.7
  • Gutenberg version: 10.3
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? Yes, TT1 Blocks. Also same issue with other FSE enabled themes.

Device information

  • Device:
  • Operating system:
  • Browser:
@talldan talldan added [Feature] Full Site Editing Needs Testing Needs further testing to be confirmed. labels Apr 12, 2021
@carolinan
Copy link
Contributor

I named my templates template-page-sidebar-left.html and so on and they show up under general.

@Sandstromer
Copy link
Author

Sorry, I should have clarified page templates beginning with 'page-'

It seems weird how templates that start 'page-' are grouped under page templates, yet 'page-home' is grouped under general.

How is it decided which page templates are 'Page templates', and which page templates are 'General templates'?

@carolinan
Copy link
Contributor

carolinan commented May 11, 2021

It looks like it is expecting the home template to be home, not page-home.

https://github.com/WordPress/gutenberg/blob/trunk/packages/edit-site/src/components/navigation-sidebar/navigation-panel/constants.js

The pr says that "page-home is an exception, it's set to shown up in General" #28291

So I think it is working as intended?

@carolinan carolinan added [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") and removed Needs Testing Needs further testing to be confirmed. labels May 11, 2021
@jameskoster
Copy link
Contributor

jameskoster commented May 19, 2021

I think the sections should work as follows:

  • The Page Templates section should contain templates that are assigned to specific pages. These are the equivalent of page-$id templates in classic themes.
  • The Post Templates section should contain templates that are assigned to specific posts. These are the equivalent of single-post-$slug templates in classic themes.
  • The General Templates section should contain templates that can be assigned to any post or page. These are the equivalent of $custom templates in classic themes.

So I think the issue here is may be the name of the template in tt1-blocks? It needs testing, but as it stands I think any template with a page- prefix will function as a general ($custom) template until a page with the appropriate suffix is created, at which point it becomes a template for that specific page. IE the page-home template in tt1-blocks functions as a $custom template until you create a page called "Home" at which point it becomes a specific page template.

@youknowriad
Copy link
Contributor

The UI has changed a lot here and these sections don't exist anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing")
Projects
None yet
Development

No branches or pull requests

5 participants