-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Support layout templates for all page kinds #12988
Comments
If I could wave a magic wand and somehow not break existing sites, I understand the desire to have one template handle all page kinds, but the purpose of a template named If the Footnotes
|
The main purpose is, as I see it, to preserve the file extension to make the file editor happy. A common setup would be to have multiple output formats with the same output format (e.g. amp.html and ... html.html, search.json data.json ...) but different templates. Of course,
Baseof templates does not work without the base/block construct, but baseof.atom.xml works fine (base/block could work nicely with base/block, I guess). |
I think it's safe to say that |
Well, this still works...
So it sure looks like a page kind, even if it isn't under the hood. |
No, it isn't. See https://gohugo.io/getting-started/glossary/#page-kind We have code in place to make old sites work, which I think I commented about in #12992. |
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
andlayouts/_default/single.atom.xml
. However, as far as I can tell RSS is hard coded with a special case forlayouts/_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
section
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.
The text was updated successfully, but these errors were encountered: