I use Zola generate a reading list on my website. I create a page for each book that I read, add some metadata (author name, pages, etc), and then loop through that section to generate stats (books read per year, for example).
This all works just fine, except that I have no way to tell Zola that I don’t wish to actually render the pages (the individual book markdown files into html pages). I only want the section data and page metadata. I end up just deleting those .html pages before publishing.
Goal: create a page which can appear section list, but (optionally) does not render it’s own page
Example directory structure:
content/reading/_index.md
content/reading/book1.md
content/reading/book2.md
When looping through pages in this section, I’d like something like render = false on the page level (rather than the section level) to allow the page not to generate /reading/book1.html
Is this currently possible? Can anyone think of a workaround?
Almost, but I don’t think draft would work, since those pages would no longer be returned for that section when we loop through section.pages
I do want the page to be available from the section, I just don’t want the page to render its .html output. The pages are used to build the section page.
Maybe another way to describe this: pages that render only in their section, but produce no page output.
Maybe helpful as an example, I was able to achieve this using Hugo (another SSG). It allows a metadata value to toggle pages being rendered and also being pages listed (in a section).
# hugo page metadata
_build:
render: false # do not render page
list: true # allow page to be listed in sections
I do something similar, I think. All I do is is to keep my data in a CSV and JSON files, read that into Zola and generate what I need. Works well for my use. And since the files are not in the content folder, there are no autogenerated pages. Guess one could do same with one page per book, so long as they are outside the content folder.
This sounds like something that might work. Am I missing the documentation for how to read in data/content that lives outside of the content directory?
Mind sharing an example folder structure and a how you loop through the files?
I think Zola can read all files in the main folder of a site but not outside, and therefore files that are not in content. I have a folder called json in the root (same level as content), and then all you need is something like
{% set data = load_data(path="json/Individual.json") %}
which is just a array you can iterate over like
{% for x in data %}
To make it work one may need to read both the zola template page Overview | Zola and the Tera page Tera