getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org
https://www.getzola.org
MIT License
13.99k stars 964 forks source link

Taximonies giving out template errors #2028

Closed Owez closed 1 year ago

Owez commented 1 year ago

Bug Report

Environment

Zola version: 0.16

Expected Behavior

I run zola build and it builds the files like normal for the following zola 16 config.toml:

# The URL the site will be built for
base_url = "https://example.com"

# Whether to automatically compile all Sass files in the sass directory
compile_sass = true

# Whether to build a search index to be used later on by a JavaScript library
build_search_index = false

# Taxonomies
taxonomies = [
    { name = "categories", feed = true },
]

[markdown]
# Whether to do syntax highlighting
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
highlight_code = false

[extra]
# Put all your custom variables here

And with a single example post in the content/ dir:

+++
title = "Hello"
date = "2022-11-19"
[taxonomies]
categories = ["Design"]
+++ 

# Example content

Stuff here

Current Behavior

I upgraded to zola 0.16, made a new website, and instead of it building, I get the following error:

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

If I add an empty html file called taxonomy_list.html it has the same error but it says about taxonomy_single.html. If I also add this, it builds fine.

Step to reproduce

Using zola 16:

  1. zola init
  2. Add a taximonies in the main section of config.toml as docs say
  3. Use taximonies in articles as like foo = ["bar"] under `[taximonies] like docs say
  4. zola build doesn't work

From zola 15 to zola 16:

  1. zola init
  2. Put taximonies in the [extra] section inside cargo.toml
  3. zola build works fine for now
  4. Migrate to zola 16
  5. Move the taximonies to the main bit of cargo.toml like docs say
  6. zola build doesn't work

Workaround

$ touch templates/taxonomy_list.html templates/taxonomy_single.html
Keats commented 1 year ago

That's expected behaviour, you need templates to be able to display the taxonomies page.

Owez commented 1 year ago

I'm just using taximonies for page categories and maybe some metainfo in the future for articles, I don't need any taximony detail page.

Keats commented 1 year ago

It looks like it's not documented on the website (:/) but you can set render = false in your config for those

Owez commented 1 year ago

Thanks, will do :)