Problem/Motivation

Themes define the design that templates are built for, but each site has to write its templates by hand for each content type.

Steps to reproduce

Proposed resolution

  • Themes and modules declare templates in their *.gutenberg.yml, each pointing to a JSON file:
    templates:
      article-hero:
        label: 'Article with hero'
        file: gutenberg/templates/article-hero.json
        template_lock: none
    
  • The content type form offers them in a "Template source" select.
  • A selected template is referenced, so the content type follows changes to it. "Customize" copies it into the content type's own template.
  • Gutenberg Base ships an example.

Remaining tasks

User interface changes

The "Template source" select.

API changes

The templates key in *.gutenberg.yml.

Data model changes

The _template_source setting.

Issue fork gutenberg-3628774

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

marcofernandes created an issue. See original summary.

  • marcofernandes committed f6dc12e8 on 4.0.x
    Issue #3628774: Let themes and modules provide content type templates
    
marcofernandes’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.