Closed jbirnick closed 4 months ago
There is the page_template
parameter in the section front-matter for that purpose: search for that string in https://www.getzola.org/documentation/content/section/
There is some templates based on path for taxonomies (https://www.getzola.org/documentation/templates/taxonomies/) but that's the exception and it would probably be better set in the config in hindsight.
Ok I guess that works, thanks!
I have another question concerning a different Hugo feature, but I will open another issue for hat.
Hello, I'm currently using Hugo for my web page, and I want to switch to Zola because of the better templating language. However, I did run into one issue, where I'm missing an essential feature that Hugo has.
This feature is that the template for a page/section can be chosen automatically based on the path of the page/section, without explicitly setting the
template = ...
frontmatter. For example, if I want to have all pages in thecontent/blog/
section to have a very specific design, then it would be great if I could just create the filetemplates/blog/page.html
and this will be preferred overtemplates/page.html
.I find this a very natural and desirable thing, so I'm wondering why it's not implemented in Zola. (I assume there is a specific reason?)
In my use case, for example, there is a certain design for "normal" pages, but then for my blog posts I have a completely different design. (You can look it up at https://jbirnick.net.) If I didn't miss anything then in Zola I have to add something like
template = "blogpost.html"
in the frontmatter of every single blog post, right? This feels wrong; it is boilerplate. Also, if I write a theme, I don't want to tell the user "hey, you have to specify these and those template files for these and those parts of the website". It should just work, based on the directory structure. What do you think?