zola
zola copied to clipboard
How to properly use taxonomies?
Documentation issue
Summary
I followed along the steps in taxonomies docs, adding the taxonomiy map in the config.toml, then add the taxonomies in the page, I basically copy pasting the steps. But then it failed to render
Error: Failed to build the site
Error: Failed to render a list of categories page.
Error: Reason: Tried to render `taxonomy_list.html` but the template wasn't found
Proposed solution
It seems that it expected a new .html file to be made(?) Maybe need to add another step in the documentation.
I don't know much about html, but after consulted with chatgpt, this works
add this to config.toml
[[taxonomies]]
name = "categories"
[[taxonomies]]
name = "tags"
then add this to the page.md
categories = ["Guillermo Del Toro"]
tags = ["2017"]
TL;DR
I think calling out that the placement of the taxonomies
definition in config.toml is important. I didn't realize the order of config keys mattered, but they seem like they do.
~Aside from the taxonomy list template error above~ (adding render = false
to my taxonomies config object fixed the need for a template), I also kept receiving the error:
Error: Failed to build the site Error: Page [PATH/TO/MARKDOWN FILE] has taxonomy
tags
which is not defined in config.toml
I had "tags" defined in config.toml
as
taxonomies = [
{name = "tags"}
]
Couldn't figure out why I received the error until I realized it had to do with the placement of where taxonomies
was located.
I got the main config confused with the page frontmatter docs; the main config has taxonomies
defined somewhere in the middle of the file, while the page frontmatter docs have [taxonomies]
defined at the bottom. I was defining taxonomies
at the bottom of my main config thinking order didn't matter and discovered moving it to where it's defined in the docs resolved my error.
I didn't realize the order of config keys mattered, but they seem like they do.
The order doesn't matter. You probably got into the worst part of TOML where you had it nested in a [dictionary] and there's no way to escape previously defined dictionaries so in that case the order does matter.