Great. So the other place that translations can appear are in the templates. Content (the markdown pages) are different from these, they’re the ones that are translated by using a different language code in the file name.
Templates on the other hand aren’t specific per language, they’re shared by all the content. So to get the ‘right’ translation, you have to use the trans
function. For example, on this page in your site:
<!-- in index.html -->
<div class="toc-item">
<a class="subtext" href="{{h.permalink | safe}}">{{ h.title }}</a>
</div>
In that example, there is no way for title
to change for a Spanish or English page. What you need to do is first add a “translation” for that in your site’s config.toml
, and then reference it using the trans
function. Like so:
# (in cargo.toml)
[languages.es.translations]
summary = "Escritorio Kalpa"
title = "Il Mondo di Zola"
Then in your index.html you can do the translation:
<!-- in index.html -->
<div class="toc-item">
<a class="subtext" href="{{h.permalink | safe}}">{{ trans(key="title", lang=lang) }}</a>
</div>
There will always be a lang
variable in scope for ever page in zola (except 404.html
), so the above code will get the English translation for the English pages, and the Spanish translation for the Spanish pages.
And if you want to just get the Spanish one each time then instead of passing in lang
to trans, you pass in the language code directly to the lang
parameter:
<a class="subtext" href="{{h.permalink | safe}}">{{ trans(key="title", lang="es") }}</a>
(and obviously the key
parameter maps to the translation you setup in the config.toml
.
Anyways, that should get you in the right direction. Feel free to come back if you need help.