My site is being generated by Zola. Its structure is roughly this:
- front page [page / section] →
- category [section within root/index/
content
folder] →- project [page within category] →
- related pages [page???]
- project [page within category] →
- category [section within root/index/
Ideally, related pages would also be hosted as pages within projects. This is where the conundrum that renders this suggestion begins.
Zola is clear about the separation of sections and pages, as well as about disallowing both to exist under the same namespace. It would then make sense to render projects as sections with section.content
etc., except one can’t simply loop over sections in the same way one does over pages.
Looping over section while maintaining access to their data requires anchoring the section in a variable within the loop, making in-loop actions (such as sorting by a section attribute) impossible. Section-based loops (for project in category.subsections
) only return verbal links to said sections (/writing/sentience/_index.md
), not section objects themselves, which is (1) confusing, (2) less useful than expected.
So far, I’ve tried making a page and a pseudo-section for the same project. This works for Zola, but doesn’t for me, because I can’t realistically access semi-dynamic content without hardlinking it within the template. (I can’t be expected to feed every new chapter of the book, for example, to the template: this kind of manual work being tedious is why things like Zola exist.) I can’t, in this configuration, render files from the pseudo-section out of the same-name page’s template, even though the two ultimately collide.
The questions I’d like to raise are:
- is there a good reason the separation between pages and sections is as strong as it’s enforced to be?
- is it possible to automatically enable the same
page + section
status from the front page to all pages if necessary?
Ideally, I’d like to be able to use a page (/content/writing/sentience.md
) for content, and a colocated section (/content/writing/sentience/
) for any additional, hierarchically-inferior pages.This makes sense in terms of precompiled content structure: pages go to the same level as their containing categories, – and allows the developer to access and manipulate content they already mentally connect as one. It also makes a degree of sense regarding HTML hierarchy, where folders form “categories” by their very nature.
Alternatively, I’d like to be able to form categories automatically out of a folder, an index.md
files (sans initial underscore), and any set of included folders or Markdown files. This makes less sense from the standpoint of Zola’s current structure, and makes more sense from the standpoint of the resulting HTML structure, aligning preproduct with product mentally.
Barring either of those, I’d like to be able to loop over sections with the same ease and to the same result as looping over pages. I’m sure this is the easiest of the three to implement. I question whether this is preferable, but then I’m not the one reifying Zola, so I yield final judgement to @keats.
I’d also be eager to discuss options not mentioned in this post. My goal is to be able to produce content with Zola as I envision it. Methods, unless convoluted or complicated, are irrelevant.