HUGO

How to list taxonomy terms by language?

When I use this method:

and have a blog.html section template where I want to list and link all used taxonomy terms in a sidepanel, how can I get this list for the current language?

In config.toml I have:

[Taxonomies]
    [languages.de.taxonomies]
        category = "rubriken"
    [languages.en.taxonomies]
        category = "categories"

for german (default) and english.

The current language tag list is always $.Site.Taxonomies.tags. You can range over them and display some kind of tag cloud… If there is a “current” in your language related question then it’s ALWAYS solvable by ignoring i18n and just go the “normal” Hugo way.

see
Taxonomy Variables | Hugo (gohugo.io)

you should use tags=[...] in frontmatter

then you can range over

site.Taxonomies.tags
or
site.Taxonimies.etiquetas

you can chck the language in .Site.Language.Lang
should be “en” or “es”

you can make different templates for different languages. HUgo will select it

Hugo’s Lookup Order | Hugo (gohugo.io)

I have lots of different taxonomies and each of them has lots of different terms.
So no way to create different templates.

Problem was that I had listed the taxonomies but the links to show the associated list page produced 404 in the additional languages.

But this is fixed now (this is a diff):

        {{ $data := .Data }}
        {{ range $key,$value := .Data.Terms.ByCount }}
-        <h2><a href="/{{ $data.Plural }}/{{ $value.Name | urlize }}.html">{{ $value.Name | humanize }}</a></h2><p class="small">In diesem Bereich: <strong>{{ $value.Count }} Artikel</strong></p>
+        <h2><a href="{{ "/" | relLangURL}}{{ $data.Plural }}/{{ $value.Name | urlize }}.html">{{ $value.Name | humanize | upper }}</a></h2>
        {{ end }}

I simply had to prefix the relLangURL