# Language specific url of current page

**URL:** <https://discourse.gohugo.io/t/language-specific-url-of-current-page/31217>\
**Category:** support\
**Created:** [February 14, 2021, 11:24am UTC](https://discourse.gohugo.io/t/language-specific-url-of-current-page/31217 "2021-02-14T11:24:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![papanito](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/papanito/32/13584_2.png) [@papanito](https://discourse.gohugo.io/u/papanito)\
**Post date:** [February 14, 2021, 11:24am UTC](https://discourse.gohugo.io/t/language-specific-url-of-current-page/31217/1 "2021-02-14T11:24:26Z")

</div>

I want to make a language switcher, which looks like this

```auto
    <ul class="shadow">
        {{ range $.Site.Home.AllTranslations }}
        <li class="dropdown_link"><a href="{{ .Permalink | absLangURL }}" target="_self" rel="noopener noreferrer">{{ .Site.Language.Params.flag }} {{ .Language.LanguageName }}</a></li>
        {{ end }}
    </ul>

```

So when I am on page `http://localhost:1313/docs/prologue/introduction/` and switch to “Deutsch” I want the page switching to `http://localhost:1313/de/docs/prologue/introduction/`. However the `.Permalink` used gives me a `href` to `href="//localhost:1313/de/"`

What do I miss?

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [February 14, 2021, 11:35am UTC](https://discourse.gohugo.io/t/language-specific-url-of-current-page/31217/2 "2021-02-14T11:35:44Z")

</div>

> What do I miss?

Something in the frontmatter of the english and german articles for that URL. Please post and someone will dive into it 🙂 I don’t have much knowledge of the whole i18n-thing (yet), but IF there is a link it means Hugo knows there is a german translation, so the error will be in the permalink generation for either post.

It could also just be some context issue with the `.` not being what you assume it is inside of the range. But to me it looks like proper code and it should work as expected.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [February 14, 2021, 11:36am UTC](https://discourse.gohugo.io/t/language-specific-url-of-current-page/31217/3 "2021-02-14T11:36:15Z")

</div>

> [@papanito](#):
>
> {{ range $.Site.Home.AllTranslations }}

On a second look: you range the HOME page translations and Hugo does what you want. You want to range the translations of that specific page.

```auto
{{ range $.Translations }}

```

---

<div class="post-metadata">

**Author:** ![papanito](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/papanito/32/13584_2.png) [@papanito](https://discourse.gohugo.io/u/papanito)\
**Post date:** [February 14, 2021, 11:40am UTC](https://discourse.gohugo.io/t/language-specific-url-of-current-page/31217/4 "2021-02-14T11:40:58Z")

</div>

Cool man, thanks for the quick help! Final solution looks like this:

```auto
...
    <ul class="shadow">
        {{ range $.AllTranslations }}
        <li class="dropdown_link"><a href="{{ .RelPermalink }}" target="_self" rel="noopener noreferrer">{{ .Site.Language.Params.flag }} {{ .Language.LanguageName }}</a></li>
        {{ end }}
    </ul>
...

```

![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/2/24e00710ec749c717451e97e5ad2afcf8dda4b57.png)

---

<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:** [February 16, 2021, 11:41am UTC](https://discourse.gohugo.io/t/language-specific-url-of-current-page/31217/5 "2021-02-16T11:41:27Z")

</div>

Closed on February 16, 2021, 11:41am UTC

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