# Multilingual Tags - bypass default linking

**URL:** <https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516>\
**Category:** support\
**Tags:** taxonomy, i18n\
**Created:** [January 19, 2023, 5:56pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516 "2023-01-19T17:56:21Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![myFrank-wk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/myfrank-wk/32/18912_2.png) [@myFrank-wk](https://discourse.gohugo.io/u/myFrank-wk)\
**Post date:** [January 19, 2023, 5:56pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/1 "2023-01-19T17:56:21Z")

</div>

The word “kurztipp” translated into English is “quick-tip”. On German web pages, I use “kurztipp” as the tag name and “quick-tip” on the translated pages. How can I create a connection between the tags? If I display the tag list “quick-tip” and change the language to German the German blog posts should be displayed with the tag “kurztipp” and vice versa. If the tag name is identical in German and English it works.

Under themes/mytheme/layouts/taxonomy/tag I created two Front Matter Markdown files with an identical translationKey:

kurztipp.md

title: “kurztipp”  
translationKey: “quicktip”

quick-tip.en.md

title: “quick-tip”  
translationKey: “quicktip”

But it does not work. What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [January 19, 2023, 6:59pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/2 "2023-01-19T18:59:34Z")

</div>

Structure

```plaintext
content/
├── de/
│ ├── posts/
│ │ └── post-1.md
│ ├── tags/
│ │ └── kurztipp/
│ │ └── _index.md <-- translationKey = 'kurztipp'
│ └── _index.md
└── en/
    ├── posts/
    │ └── post-1.md
    ├── tags/
    │ └── quick-tip/
    │ └── _index.md <-- translationKey = 'kurztipp'
    └── _index.md

```

Example

```plaintext
git clone --single-branch -b hugo-forum-topic-42516 https://github.com/jmooring/hugo-testing hugo-forum-topic-42516
cd hugo-forum-topic-42516
hugo server

```

---

<div class="post-metadata">

**Author:** ![myFrank-wk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/myfrank-wk/32/18912_2.png) [@myFrank-wk](https://discourse.gohugo.io/u/myFrank-wk)\
**Post date:** [January 19, 2023, 7:57pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/3 "2023-01-19T19:57:37Z")

</div>

Thank you. My structure is as follows:

content/blog/adjust-date  
content/blog/adjust-date/img/picture1.jpg  
content/blog/adjust-date/index.en.md  
content/blog/adjust-date/index.md  
content/blog/pagination/img/picture1.jpg  
content/blog/pagination/index.en.md  
content/blog/pagination/index.md  
content/blog/\_index.en.md  
content/blog/\_index.md

The following does not work:

content/blog/adjust-date/  
content/blog/tags/  
content/blog/tags/kurztipp/\_index.md  
content/blog/tags/quick-tip/\_index.md  
content/blog/\_index.en.md  
content/blog/\_index.md

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [January 19, 2023, 7:58pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/4 "2023-01-19T19:58:43Z")

</div>

Did you clone and test the example that I provided?

---

<div class="post-metadata">

**Author:** ![myFrank-wk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/myfrank-wk/32/18912_2.png) [@myFrank-wk](https://discourse.gohugo.io/u/myFrank-wk)\
**Post date:** [January 19, 2023, 8:11pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/5 "2023-01-19T20:11:07Z")

</div>

Yes, I have. I have a different structure. That’s why I don’t understand the example.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [January 19, 2023, 8:16pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/6 "2023-01-19T20:16:55Z")

</div>

> [@myFrank-wk](#):
>
> content/blog/tags/kurztipp/\_index.md  
> content/blog/tags/quick-tip/\_index.md

There’s no way that’s going to work. It would have to be:

```auto
content/tags/kurztipp/_index.md
content/tags/quick-tip/_index.md

```

---

<div class="post-metadata">

**Author:** ![myFrank-wk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/myfrank-wk/32/18912_2.png) [@myFrank-wk](https://discourse.gohugo.io/u/myFrank-wk)\
**Post date:** [January 19, 2023, 8:24pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/7 "2023-01-19T20:24:19Z")

</div>

This also does not work. Unfortunately.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [January 19, 2023, 8:30pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/8 "2023-01-19T20:30:55Z")

</div>

Guessing is an inefficient usage of our time. Perhaps you can share your repository, privately if you wish.

---

<div class="post-metadata">

**Author:** ![myFrank-wk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/myfrank-wk/32/18912_2.png) [@myFrank-wk](https://discourse.gohugo.io/u/myFrank-wk)\
**Post date:** [January 19, 2023, 8:33pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/9 "2023-01-19T20:33:29Z")

</div>

Yes, I will send you a private email tomorrow. Thank you.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [January 20, 2023, 11:39pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/10 "2023-01-20T23:39:11Z")

</div>

You do not separate your translations by directory, but instead use this structure:

```plaintext
content/posts/
├── post-1.en.md
└── post-1.md

```

Which is fine; we just need to use a different approach to translate and link the tags.

Please pull this again and test:

```auto
git clone --single-branch -b hugo-forum-topic-42516 https://github.com/jmooring/hugo-testing hugo-forum-topic-42516
cd hugo-forum-topic-42516
hugo server

```

With this approach you use the same tag for all languages, but control its appearance (name) and URL in the term’s front matter.

You will need to modify your tag cloud code accordingly, something like:

```plaintext
<div class="widget">
  <div class="tag-cloud-tags widget-content">
    {{- $taxonomy := "tags" -}}
    {{- range $term, $weightedPages := index site.Taxonomies $taxonomy -}}
      {{- $t := site.GetPage (printf "/%s/%s" $taxonomy $term) -}}
      {{- $currentFontSize := (add $smallestFontSize (mul (sub $weightedPages.Count $minCount) $sizeStep)) -}}
        <a href="{{ $t.RelPermalink }}" aria-label="{{ $t.Title }} ({{ $weightedPages.Count }} posts)" class="tag-link" style="font-size:{{- $currentFontSize -}}rem; color:{{- partial "shuffelColor.html" . -}}; transform:rotate({{- partial "shuffelRotate.html" . -}});">{{- $t.Title -}}
          <span style="font-size: {{- $smallestFontSize -}}rem"> ({{- $weightedPages.Count -}})</span></a>
    {{- end -}}
  </div>
</div>

```

---

<div class="post-metadata">

**Author:** ![myFrank-wk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/myfrank-wk/32/18912_2.png) [@myFrank-wk](https://discourse.gohugo.io/u/myFrank-wk)\
**Post date:** [January 21, 2023, 7:03am UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/11 "2023-01-21T07:03:01Z")

</div>

Do I understand this correctly now? For a multilingual website I have to create directories for the different languages in the content directory - de, en. Then I copy my current Page Bundles into both directories. Delete index.en.md in the “de” directory and index.md in the “en” directory and index.en.md is renamed to index.md. I have to change the config.toml accordingly.

I still come from a time when memory was valuable. That’s why I liked the Page Bundles approach - store images only once, for one blog post all in one place and not scattered in different directories. My blog posts are all about Hugo and web design. It makes no sense to translate English IT terms into German, then no one understands you anymore. “Kurztipp” = “Quick-tip” is therefore the only tag which is different from the language. It’s amazing that the whole thing worked at all until now.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [January 21, 2023, 7:43am UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/12 "2023-01-21T07:43:19Z")

</div>

> [@myFrank-wk](#):
>
> Do I understand this correctly now?

No.

Please clone the revised example and look at the structure. Or I can post your revised site to a repository somewhere.

EDIT: I did not push the changes earlier today. I just pushed them. Please clone and test.

---

<div class="post-metadata">

**Author:** ![alcarazr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/alcarazr/32/11576_2.png) [@alcarazr](https://discourse.gohugo.io/u/alcarazr)\
**Post date:** [January 21, 2023, 7:46am UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/13 "2023-01-21T07:46:52Z")

</div>

As I understand it, we need to create an `_index.md` file with that `translationKey` in frontmatter for each of our tags, right? Guess there’s no way to automate it 🤔

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [January 21, 2023, 7:50am UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/14 "2023-01-21T07:50:25Z")

</div>

There are two methods to organize multilingual site content. Whether or not you need a translation key depends on which method you choose. And this discussion is limited to taxonomy term translations, including the URL.

---

<div class="post-metadata">

**Author:** ![alcarazr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/alcarazr/32/11576_2.png) [@alcarazr](https://discourse.gohugo.io/u/alcarazr)\
**Post date:** [January 21, 2023, 7:55am UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/15 "2023-01-21T07:55:26Z")

</div>

Thanks, Joe. In my case I’m using different folders for each of my languages. Didn’t know about that [bypassing](https://gohugo.io/content-management/multilingual/#bypassing-default-linking) though, so I was keeping always the same structure.

---

<div class="post-metadata">

**Author:** ![myFrank-wk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/myfrank-wk/32/18912_2.png) [@myFrank-wk](https://discourse.gohugo.io/u/myFrank-wk)\
**Post date:** [January 21, 2023, 9:05pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/16 "2023-01-21T21:05:36Z")

</div>

Thanks a lot Joe. Your advice on displaying the tags instead of {{ with .Params.tags }} {{ range . }} to output the tags with {{ range .GetTerms “tags” }} was key in addition to the hints above. Now “kurztipp” is also translated correctly.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [January 23, 2023, 9:05pm UTC](https://discourse.gohugo.io/t/multilingual-tags-bypass-default-linking/42516/17 "2023-01-23T21:05:41Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
