# 0.123.8 TranslationKey does not connect term pages

**URL:** <https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829>\
**Category:** support\
**Tags:** i18n, v0-123-x\
**Created:** [March 14, 2024, 6:43am UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829 "2024-03-14T06:43:25Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![jzeneto](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jzeneto/32/9539_2.png) [@jzeneto](https://discourse.gohugo.io/u/jzeneto)\
**Post date:** [March 14, 2024, 6:43am UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/1 "2024-03-14T06:43:25Z")

</div>

Since 0.123.0 onwards, `translationKey` doesn’t work as before. Before I could just put a value like `presentation` in two files and they would be linked together, getting `.IsTranslated` as `true`, a list of `.Translations` etc. With 0.123.x, I can’t see how to make it work.

I see this happening in term pages, with one of the translations having diacritics (for example, “music” in en and “música” in pt). I didn’t test in other kinds of pages.

Inspecting `translationKey` value, I saw that for pages with no such field in frontmatter `.TranslationKey` returns the page’s logical path, always beginning with a `/`. So I tried to put `/` in my translation keys, as a test, and it worked, but **only** while the Hugo server was running. Stopping and starting it again breaks again the translation linking.

I discovered it because something I don’t know whether is a bug or by-design: starting with 0.123.0, taxonomy terms that have diacritics (like “música”) need to have that diacritics when creating a custom content file (like, `categories/música/index.pt.md`). Before 0.123.0 that was not the case, it was mandatory to **not have** any diacritics (so I had `categories/musica/index.pt.md`, attention to the lack of diacritics here). Even if it is by-design (perhaps it has to do with the new logical `.Path`), it would be nice to document this behaviour.

---

<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:** [March 14, 2024, 2:57pm UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/2 "2024-03-14T14:57:03Z")

</div>

With the test site below, setting `translationKey` in front matter behaves as expected for all markdown files:

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

```

content structure

```plaintext
content/
├── categories/
│ ├── music/
│ │ ├── _index.en.md
│ │ └── cover.en.jpg
│ └── música/
│ ├── _index.pt.md
│ └── cover.pt.jpg
├── _index.en.md
├── _index.pt.md
├── p1-foo.pt.md
└── p1.en.md

```

> [@jzeneto](#):
>
> starting with 0.123.0, taxonomy terms that have diacritics (like “música”) need to have that diacritics when creating a custom content file

That is correct, and makes much more sense.

> [@jzeneto](#):
>
> it would be nice to document this behaviour

See [https://github.com/gohugoio/hugoDocs/issues/2465](https://github.com/gohugoio/hugoDocs/issues/2465)

---

<div class="post-metadata">

**Author:** ![jzeneto](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jzeneto/32/9539_2.png) [@jzeneto](https://discourse.gohugo.io/u/jzeneto)\
**Post date:** [March 14, 2024, 8:55pm UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/3 "2024-03-14T20:55:27Z")

</div>

> [@jmooring](#):
>
> behaves as expected

In fact, no, it doesn’t — in term pages. I’ve run your test site, and yes, it correctly behaves in post pages. But in term pages (in this case, either `/pt/categories/música/` or `/en/categories/music/`), it doesn’t find any translations, and it’s possible to see it from the rendered page: there’s no “English Portuguese” links to alternate between languages in those term pages.

---

<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:** [March 14, 2024, 9:09pm UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/4 "2024-03-14T21:09:25Z")

</div>

Sorry, I’m missing something.

1. `music` and `música` are two different terms (they might as well be “foo” and “bar”)
2. `music` is assigned to content/p1.en.md
3. `música` is assigned to content/p1-foo.pt.md

If I understand correctly, you want to connect two completely different objects via translation. Is that right?

---

<div class="post-metadata">

**Author:** ![jzeneto](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jzeneto/32/9539_2.png) [@jzeneto](https://discourse.gohugo.io/u/jzeneto)\
**Post date:** [March 14, 2024, 9:20pm UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/5 "2024-03-14T21:20:40Z")

</div>

> [@jmooring](#):
>
> you want to connect two completely different objects via translation

Strictly speaking, yes, but in your test site, `p1-foo.pt.md` and `p1.en.md` are also two different objects (again, strictly speaking). Because conceptually, `music` and `música` are not different terms, but translations of a same term.

And again, although you’ve put a `translationKey` both in `music` and `música` content files, that key is ignored. I can’t see a rationale behind `translationKey` other than cases like this: connecting objects that are different from Hugo’s POV, but translations of a same object from user’s POV.

---

<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:** [March 14, 2024, 9:26pm UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/6 "2024-03-14T21:26:49Z")

</div>

I guess I am more accustomed to seeing the same term used across all languages, then translated.

Regardless, you could do what you wanted in v0.122.0, but not in v0.123.x… so I’ll log an issue.

---

<div class="post-metadata">

**Author:** ![jzeneto](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jzeneto/32/9539_2.png) [@jzeneto](https://discourse.gohugo.io/u/jzeneto)\
**Post date:** [March 14, 2024, 9:36pm UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/7 "2024-03-14T21:36:10Z")

</div>

> [@jmooring](#):
>
> I’ll log an issue

Thank you!

> [@jmooring](#):
>
> then translated

How I’d do that? Using `title` in term content file?

---

<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:** [March 14, 2024, 9:37pm UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/8 "2024-03-14T21:37:49Z")

</div>

> [@jzeneto](#):
>
> How I’d do that? Using `title` in term content file?

Yes.

And when displaying terms on content pages, never do this:

```auto
{{ range .Params.categories }}

```

Always use `.Page.GetTerms`. This makes life so simple, yet I still see site theme authors doing it the hard (wrong) way.

---

<div class="post-metadata">

**Author:** ![jzeneto](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jzeneto/32/9539_2.png) [@jzeneto](https://discourse.gohugo.io/u/jzeneto)\
**Post date:** [March 14, 2024, 9:46pm UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/9 "2024-03-14T21:46:28Z")

</div>

> [@jmooring](#):
>
> Always use `.Page.GetTerms`

Yeah, I already use this approach (also because I have other taxonomies beyond tags and categories), but thank you to pointing it out!

---

<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:** [March 15, 2024, 2:53pm UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/10 "2024-03-15T14:53:06Z")

</div>

See [https://github.com/gohugoio/hugo/issues/12261](https://github.com/gohugoio/hugo/issues/12261)

In the interest of tracking forum topics related to v0.123.x that do **not** have a corresponding GitHub issue, I am marking this resolved.

---

<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:** [March 15, 2024, 3:05pm UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/11 "2024-03-15T15:05:09Z")

</div>

> [@jmooring](#):
>
> I guess I am more accustomed to seeing the same term used across all languages, then translated.

Initial response from bep indicates that you should do the above instead.

---

<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:** [March 15, 2024, 6:41pm UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/12 "2024-03-15T18:41:43Z")

</div>

A [fix for this](https://github.com/gohugoio/hugo/pull/12262) will be available in the next release, but I still recommend using a single term across all languages, and translate via the term’s branch bundle titles.

---

<div class="post-metadata">

**Author:** ![jzeneto](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jzeneto/32/9539_2.png) [@jzeneto](https://discourse.gohugo.io/u/jzeneto)\
**Post date:** [March 16, 2024, 12:50am UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/13 "2024-03-16T00:50:40Z")

</div>

> [@jmooring](#):
>
> A [fix for this](https://github.com/gohugoio/hugo/pull/12262) will be available in the next release

Thank you!

> [@jmooring](#):
>
> using a single term across all languages,

Yes, it seems more elegant and simpler. I don’t exactly remember why I’ve chosen the other way, as it’s a side project in which I work from time to time and that decision was took by me-from-two-years-ago haha.

---

<div class="post-metadata">

**Author:** ![jzeneto](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jzeneto/32/9539_2.png) [@jzeneto](https://discourse.gohugo.io/u/jzeneto)\
**Post date:** [March 16, 2024, 1:39am UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/14 "2024-03-16T01:39:12Z")

</div>

> [@jmooring](#):
>
> recommend using a single term across all languages

In fact I now remember why I’ve chosen the other way: to get correct URLs. In the “música/music” example this is a minor problem, but with “comunicação/presentation” this is much worse (these are academic terms, changing them in my site would be wrong).

Can I accomplish correct URLs with the recommended way, so “/musica” and “/music”, “/comunicacao” and “/presentation” linked to each other?

(I’ve already configured the taxonomy translation itself. And sorry for asking, I’m in a travel now and only will be able to experiment and test by myself in next Thursday, but I didn’t want to lose the momentum of this question…)

---

<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:** [March 16, 2024, 1:58am UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/16 "2024-03-16T01:58:16Z")

</div>

content/categories/music/\_index.en.md

```plaintext
---
title: music
---

```

content/categories/music/\_index.pt.md

```plaintext
---
title: música
url: categories/música
---

```

Notice that the `url` does NOT begin with a slash. This is important.

[https://gohugo.io/content-management/urls/#url](https://gohugo.io/content-management/urls/#url)

> In a multilingual site:
> 
> - A `url` value with a leading slash is relative to the `baseURL`.
> - A `url` value without a leading slash is relative to the `baseURL` plus the language prefix.

---

<div class="post-metadata">

**Author:** ![jzeneto](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jzeneto/32/9539_2.png) [@jzeneto](https://discourse.gohugo.io/u/jzeneto)\
**Post date:** [March 16, 2024, 11:37am UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/17 "2024-03-16T11:37:50Z")

</div>

Thank you!

---

<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:** [March 18, 2024, 11:38am UTC](https://discourse.gohugo.io/t/0-123-8-translationkey-does-not-connect-term-pages/48829/18 "2024-03-18T11:38:28Z")

</div>

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