Open bep opened 1 year ago
I have just encountered a situation where I would like to be able to modify which baseof.html
is used for a specific content type based on the value in an environment variable... this change/issue would permit that setup? ❤️
The files in the PR in #11024 is a technical way of implementing this in the templates today (we could consider adding some built-ins for this if needed). Those file don't demonstrate "how useful" this is, but I will talk a little about that below.
In many sites, even bigger ones, you end up wanting to have only one
baseof.html
template. You can of course create several templates and avoid some DRYness by adding the common pieces via partials, but it can still be a hassle if only small parts of your base template changes.The tooling you have for this today are:
block
definitions in the base template that can be implemented withdefine
in e.g.single.html
.partial
ortemplate
invocations from the base template.But there are often subtle structural difference in the different layouts (e.g. grid layouts, table of contents), which leads to either
{{ if .IsPage }}Insert table of contents{{ end }}
The above construct may help simplify things, and it could also be a way to pass data up to the base template.