-
Notifications
You must be signed in to change notification settings - Fork 124
Alternate template/template part implementation #411
Description
Derived from a number of questions and comments throughout the project, one thing that's clear is that we need to iron out our approach to alternate templates (business, portfolio, writer home/blog/single templates).
Templates
Currently, TT4 has templates for each "use case" available in the site editor entirely.
You can apply a different template to a specific page within the post editor, and with Gutenberg 16.7, you can swap templates for other like templates (such as page templates). Swapping from template, to template, is not yet available (Blog Home -> Alternate Blog Home), but it's not a big ask to add the existing functionality to the Template Inspector WordPress/gutenberg#54562.
To enable template swapping, templates need to be abstracted into patterns, like in this pr. We can have patterns that are essentially template content (page-01-business-home.php), and corresponding templates that reference the pattern (home.html).
This is fine for the one home, or archive page, but if we have each of the alternative archive designs (writer and portfolio) as individual templates, we start to see where this model is fragile. Why expose two archive pages that are irrelevant to the site as templates in the site editor?
You can't use the "Archive Portfolio" template instead of "Archive Writer" — not without WordPress/gutenberg#54562. But when that issue is resolved, it pushes forward the notion of swapping, rather than providing those all top-level as templates.
I propose we make all alternative index/archive/search designs as patterns in the template swap flow. And for single/page designs, either rename to make them more generic, or do the same.
Visuals
Current site editor templates view. There are more templates in the queue to add even:
Selecting an alternate template within the post editor:
Selecting an alternate template within the site editor:
Naming templates and template parts
However we decide to move forward with the template implementation, we should consider renaming templates, patterns, and template parts to reduce the visibility of "Business", "Portfolio", and "Writer" terminology. This would follow suite with how core patterns are named as well, where the actual title of the pattern helps identify what it is. And also allow for more flexible use cases.
Examples (drafts):
Footer portfolio (pattern) -> Three column footer with colophon
Footer writer (pattern) -> Minimal centered footer with logo and navigation
Page portfolio (template) -> Wide image with title content below
And perhaps this helps clear the confusion with the lot of templates provided.
Template parts
TT4 also has multiple header and footer designs, originally intended to be applied to corresponding templates. I.e. the "Footer Portfolio" design would be applied to the "Home Portfolio" template.
I suggest we don't do this, but rather only provide one "footer" template part (and header), which people then have the ability to replace the footer with the provided alternatives. Using this method, the header/footer parts on a site are always in sync — unless the user chooses to create and display a different header on a page.
When you change a footer to use the "Footer Portfolio" design, it will be applied throughout the site, rather than having one template with "Footer Portfolio" and another with "Footer Writer".
Related:
#406 (comment), #9 (comment), #351 (comment), #368 (comment)