Skip to content

Support layout templates for all page kinds #12988

Closed
@akbyrd

Description

@akbyrd

Use case: I want to make a single layout template that applies to both section and page kinds.

I have a custom output format for Atom feeds and a template to render them.

Currently I need to create both layouts/_default/list.atom.xml and layouts/_default/single.atom.xml. However, as far as I can tell RSS is hard coded with a special case for layouts/_default/rss.xml where the page kind is not required. This is great - I propose the same behavior for all layout templates.

If I try to write the valid template locations for home and section page kinds it looks something like this:

home

layouts[/{<type>|_default}]/{<layout>|index|<kind>|list}.<format>
optional for RSS            ^---------------------------^

section

layouts/{<type>|<section>|<kind>|/_default}/{<layout>|<section>|<kind>|list}.<format>
optional for RSS                            ^-------------------------------^

Where {a|b} means one of several values, [] means optional, and <> means a value replaced by page data. Not 100% accurate and I've left out a lot of detail, but I think close enough for this discussion.

For the part I've marked as optional for RSS it would be great if it were optional for other layout templates as well.

This is added functionality, so is less likely to break existing sites. It also seems like it might make the template locations slightly easier to understand since it's more consistent.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions