Zola 12 Config.toml

There is now sensitivity to order of config elements in the config.toml.

I just included some new Zola 12 search related config.toml attributes and the site failed to build.

Changing the order of the configuration, and the site now builds:

config.toml order that will fail

# Whether to build a search index to be used later on by a JavaScript library
build_search_index = true
[search]
# Whether to include the title of the page/section in the index
include_title = true
# Whether to include the description of the page/section in the index
include_description = false
# Whether to include the rendered content of the page/section in the index
include_content = true
# At which character to truncate the content to. Useful if you have a lot of pages and the index would
# become too big to load on the site. Defaults to not being set.
truncate_content_length = 200
# a description; you can use markdown here if you like
description=""
default_language = "en"
highlight_theme = "solarized-light"
# New in Version 11 - Zola moved to default to atom.xml to to keep our old podcast names we need to use this config var
feed_filename = "rss.xml"
feed_limit = 75
generate_feed = true
# The taxonomies to be rendered for that site and their configuration
# Example:
taxonomies = [
    {name = "tags", feed = false, paginate_by = 6}, 
    {name = "english", feed = false, paginate_by = 6},  
    {name = "authors", feed = true, paginate_by = 2}, 
    {name = "downloads",  feed = false, paginate_by = 8},
    {name = "podcast", feed = true, paginate_by = 75}, 
]
[extra]

Console error message:

C:\Users\Iria\Zola\production (master -> origin)
λ zola build -u https://adeptenglish.com -o ..\deployment\ZOLA12-Search
Building site...
-> Creating 178 pages (0 orphan), 6 sections, and processing 0 images
Failed to build the site
Error: Failed to render section 'C:/Users\Iria\Zola\production\content\_index.md'
Reason: Failed to render 'index.html'
Reason: Function call 'get_taxonomy_url' failed
Reason: `get_taxonomy_url` received an unknown taxonomy as kind: english

config.toml that will work (just changed the order)

# New in Version 11 - Zola moved to default to atom.xml to to keep our old podcast names we need to use this config var
feed_filename = "rss.xml"
feed_limit = 75
generate_feed = true
# The taxonomies to be rendered for that site and their configuration
# Example:
taxonomies = [
    {name = "tags", feed = false, paginate_by = 6}, 
    {name = "english", feed = false, paginate_by = 6},  
    {name = "authors", feed = true, paginate_by = 2}, 
    {name = "downloads",  feed = false, paginate_by = 8},
    {name = "podcast", feed = true, paginate_by = 75}, 
]
# Whether to build a search index to be used later on by a JavaScript library
build_search_index = true
[search]
# Whether to include the title of the page/section in the index
include_title = true
# Whether to include the description of the page/section in the index
include_description = false
# Whether to include the rendered content of the page/section in the index
include_content = true
# At which character to truncate the content to. Useful if you have a lot of pages and the index would
# become too big to load on the site. Defaults to not being set.
truncate_content_length = 200
[extra] 
...

console output success:

C:\Users\Iria\Zola\production (master -> origin)
λ zola build -u https://adeptenglish.com -o ..\deployment\ZOLA12-Search
Building site...
-> Creating 178 pages (0 orphan), 6 sections, and processing 0 images
Done in 23.8s.

Observation

  • It looks like some logic depends upon the taxonomies config variables being set before any search related functionality is started.

If you add any config group

for example:

[slugify]
paths = "on"
taxonomies = "on"
anchors = "on"

above taxonomies:

taxonomies = [
    {name = "tags", feed = false, paginate_by = 6}, 
    {name = "english", feed = false, paginate_by = 6},  
    {name = "authors", feed = true, paginate_by = 2}, 
    {name = "downloads",  feed = false, paginate_by = 8},
    {name = "podcast", feed = true, paginate_by = 75}, 
]

You will get random errors on building the site.

This random error was:

C:\Users\Iria\Zola\production (master -> origin)
λ zola serve -i 192.168.1.101 -p 2015 -u 192.168.1.101
Building site...
Failed to load C:\Users\Iria\Zola\production\config.toml
Error: duplicate field `taxonomies` for key `slugify` at line 255 column 1

observations

  • Need to make clear in documentation that new config.toml is order sensitive
  • Need to advise that changes to config.toml required for older versions?

That’s just TOML that sucks :frowning:

1 Like