Multi word taxonomies, how to use in partial?

Good day,

I am trying to build a multilingual website and part of the process is to also translate the taxonomies. All is well until I encountered a roadblock with taxonomy URLs.

[Solved] In our local language, we add the word “mga” to make a word “plural”. Using “tags” as an example, it would be: mga tag.

[Solved] I have this in my config file: tag = "mga tag". Since taxonomies are using the plural form as its default slug, the two-word format generates a space and results in a 404 error even though there is content with "mga tag" = ["sometag"] frontmatter.

[Solved] There are two ways I am thinking of solving this but I can’t find a way to do it.

  1. By adding a slug to a taxonomy. In the example, I can set it to mga-tag.
  2. Create a translation of the taxonomies through the i18n method. Then let the system detect if it should display /lang_code/tag/tag_name/ or /tag/tag_name/?

Update for above: It appeared that it’s in the theme. After changing to absLangURL and adding urlize where needed, it worked fine.

Edit: Now I only have to figure this last part. (Apologies, first time with GoLang.)

In addition to the above, the theme I am using–Clarity–have this {{ range .Site.Taxonomies.tags.featured }} for its “Featured Post” feature. Since the plural form of the translated taxonomies have two words, I can’t use it to display Featured Post in the translated website.

Thank you.

Hugo Static Site Generator v0.74.2-48565DE6/extended linux/amd64 BuildDate: 2020-07-17T17:32:27Z

Use index:

{{ $mgatag := index site.Taxonomies "mga tag" }}

{{ range $k, $v := $mgatag }}
  {{ if eq $k "lorem ipsum" }} <!-- mga tag: "lorem ipsum" -->
    {{ range $v.Pages }}
      {{ .Page }}<br>
    {{ end }}
  {{ end }}
{{ end }}
{{ end }}

Thank you very much!

I ended up using a param key instead of the theme’s taxonomy based “featured” method.

    {{ range where .Site.Pages ".Params.featured" true }}
     {{- if ne $title .Title }}
        <a href="{{ .Permalink }}" class="nav-link">{{ .Title }}</a>
     {{- end }}
    {{ end }}

I retained much of the theme’s code above.


Thank you very much again!