# I want to get the link to the other language page of the multilingual page

**URL:** <https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022>\
**Category:** support\
**Created:** [April 22, 2023, 3:36pm UTC](https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022 "2023-04-22T15:36:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ardacarofficial](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ardacarofficial/32/21327_2.png) [@ardacarofficial](https://discourse.gohugo.io/u/ardacarofficial)\
**Post date:** [April 22, 2023, 3:36pm UTC](https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022/1 "2023-04-22T15:36:47Z")

</div>

I have a multilingual page. I want to get the url of the other language page of the page I am on.

---

<div class="post-metadata">

**Author:** ![idarek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/idarek/32/26229_2.png) [@idarek](https://discourse.gohugo.io/u/idarek)\
**Post date:** [April 22, 2023, 4:02pm UTC](https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022/2 "2023-04-22T16:02:02Z")

</div>

If you got everything set correctly, here is an example code to achieve what you want:

```auto
<div id="language">
{{ range site.Home.Translations }}
    <a class="{{ .Lang }}" title="{{ .Lang }}" lang="{{ .Lang }}" hreflang="{{ .Lang }}" href="{{ .Permalink }}">
        {{ .Lang }}
    </a>
{{ end }}
</div>

```

---

<div class="post-metadata">

**Author:** ![ardacarofficial](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ardacarofficial/32/21327_2.png) [@ardacarofficial](https://discourse.gohugo.io/u/ardacarofficial)\
**Post date:** [April 22, 2023, 4:11pm UTC](https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022/3 "2023-04-22T16:11:28Z")

</div>

Thank you, this helped me, but for example, for example, I am on the hello-world page, if I want to get the Turkish language of that page instantly at that moment, what will I do, this should be automatically.

---

<div class="post-metadata">

**Author:** ![idarek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/idarek/32/26229_2.png) [@idarek](https://discourse.gohugo.io/u/idarek)\
**Post date:** [April 22, 2023, 4:15pm UTC](https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022/4 "2023-04-22T16:15:57Z")

</div>

What do you mean under “instantly” and “should be automatically”?

---

<div class="post-metadata">

**Author:** ![ardacarofficial](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ardacarofficial/32/21327_2.png) [@ardacarofficial](https://discourse.gohugo.io/u/ardacarofficial)\
**Post date:** [April 22, 2023, 4:18pm UTC](https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022/5 "2023-04-22T16:18:38Z")

</div>

For example:

`example.com/en/hello-world/`

I am on the page of this page and there is a Turkish page and that page is this:

`example.com/tr/merhaba-dunya/`

When I am on the `example.com/en/hello-world/` page, I want to link to `example.com/tr/merhaba-dunya/` by saying that there is a Turkish version of this article at the bottom. And since I will put it in the `footer.html` of each article, it should be automatic.

I wanted to say this.

---

<div class="post-metadata">

**Author:** ![idarek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/idarek/32/26229_2.png) [@idarek](https://discourse.gohugo.io/u/idarek)\
**Post date:** [April 22, 2023, 4:38pm UTC](https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022/6 "2023-04-22T16:38:49Z")

</div>

Just change the code that I provided, whatever is in between `<a>...</a>` like

```auto
<div id="language">
{{ range site.Home.Translations }}
    <a class="{{ .Lang }}" title="{{ T "LanguageText" }}" lang="{{ .Lang }}" hreflang="{{ .Lang }}" href="{{ .Permalink }}">
        {{ T "LanguageText" }}
    </a>
{{ end }}
</div>

```

in `\i18n\en.toml`

```auto
[LanguageText]
other = "Read Turkish version of this article"

```

in `\i18n\tr.toml`

```auto
[LanguageText]
other = "Bu makalenin İngilizce sürümünü okuyun"

```

---

<div class="post-metadata">

**Author:** ![ardacarofficial](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ardacarofficial/32/21327_2.png) [@ardacarofficial](https://discourse.gohugo.io/u/ardacarofficial)\
**Post date:** [April 22, 2023, 5:12pm UTC](https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022/7 "2023-04-22T17:12:44Z")

</div>

Unfortunately, it doesn’t work. I want to tell you this.

my current page: `https://example.com/en/hello-world/`  
Other language page that matches this one: `https://example.com/tr/merhaba-dunya/`

When I go to `https://example.com/en/hello-world/`, it should give me `https://example.com/tr/merhaba-dunya/` as output.

the code you gave does not work. Thank you very much for your concern, though.

---

<div class="post-metadata">

**Author:** ![idarek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/idarek/32/26229_2.png) [@idarek](https://discourse.gohugo.io/u/idarek)\
**Post date:** [April 22, 2023, 5:17pm UTC](https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022/8 "2023-04-22T17:17:59Z")

</div>

You need to connect `/hello-world/` and `/merhaba-dunya/` together using `translationKey`.

Set in both markdown files, English and Turkish (in both that same as below):

```auto
translationKey: hello-world

```

---

<div class="post-metadata">

**Author:** ![ardacarofficial](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ardacarofficial/32/21327_2.png) [@ardacarofficial](https://discourse.gohugo.io/u/ardacarofficial)\
**Post date:** [April 22, 2023, 6:36pm UTC](https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022/9 "2023-04-22T18:36:38Z")

</div>

```auto
  {{- if .IsTranslated -}}
      {{ range .Translations }}
      {{ .Permalink }}
      {{- end -}}
  {{ end }}

```

I solved the problem with this code, thank you for your reply.

---

<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:** [April 24, 2023, 6:36pm UTC](https://discourse.gohugo.io/t/i-want-to-get-the-link-to-the-other-language-page-of-the-multilingual-page/44022/10 "2023-04-24T18:36:53Z")

</div>

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