WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.46k stars 4.18k forks source link

Custom Templates: Should use "title" instead of "name" when displayed to the user #32818

Closed kjellr closed 3 years ago

kjellr commented 3 years ago

When adding a custom template using the following example from the docs, the name that shows up in the UI is what's entered into the name field:

{
    "version": 1,
    "customTemplates": [
        {
            "name": "my-custom-template",
            "title": "The template title",
            "postTypes": [
                "page",
                "post",
                "my-cpt"
            ]
        }
    ]
}
Site Editor Sidebar Site Editor Title Bar Post/page Editor
Screen Shot 2021-06-18 at 9 47 37 AM Screen Shot 2021-06-18 at 9 48 54 AM Screen Shot 2021-06-18 at 9 47 59 AM

I would've expected the "Title" field to show up in the UI, since that's the one that includes proper capitalization.

kjellr commented 3 years ago

This is related to, or possibly a duplicate of https://github.com/WordPress/gutenberg/issues/31704.

carolinan commented 3 years ago

I went down a 3 hour rabbit hole, so I am removing the good first issue label 😊

Mamaduka commented 3 years ago

Hi, @carolinan. Are you still working on this issue?

carolinan commented 3 years ago

No, but you could start here: https://github.com/WordPress/gutenberg/blob/trunk/lib/full-site-editing/block-templates.php#L222 https://github.com/WordPress/gutenberg/blob/trunk/lib/full-site-editing/block-templates.php#L225

carolinan commented 3 years ago

The HTML file itself never includes the name, only theme.json does, so the slug is used twice.

Mamaduka commented 3 years ago

Thank you, @carolinan.