getzola / book

Gitbook theme for Zola
MIT License
57 stars 19 forks source link

Multilingual Menu #19

Open jmzagorski opened 3 years ago

jmzagorski commented 3 years ago

I was wondering if it was in the scope of this project to change the menu for multi-lingual sites? Currently the index.html template has:

set index = get_section(path="_index.md")

Is it possible to set the index with this logic:

{% if lang == config.default_language %}{% set index = "_index.md" %}{% else %}{% set indx= "_index." ~ lang ~ ".md" %}{% endif %}

My team is pretty new to zola, so if we are overlooking something with this logic or your implementation please let me know. Right now we override the menu block with this logic. However, we may have a few documentation sites that will need to implement this override. Thanks for a great theme!

Keats commented 3 years ago

The next Zola version will have better handling for languages and you should be able to just do get_section(path="_index.md", lang=lang) (hopefully)

jmzagorski commented 3 years ago

Great news! Thank you for the update.