# \[SOLVED\] How to fetch the defaultContentLanguage setting in a template?

**URL:** <https://discourse.gohugo.io/t/solved-how-to-fetch-the-defaultcontentlanguage-setting-in-a-template/12397>\
**Category:** support\
**Created:** [June 13, 2018, 11:05am UTC](https://discourse.gohugo.io/t/solved-how-to-fetch-the-defaultcontentlanguage-setting-in-a-template/12397 "2018-06-13T11:05:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nop33](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nop33/32/6177_2.png) [@nop33](https://discourse.gohugo.io/u/nop33)\
**Post date:** [June 13, 2018, 11:05am UTC](https://discourse.gohugo.io/t/solved-how-to-fetch-the-defaultcontentlanguage-setting-in-a-template/12397/1 "2018-06-13T11:05:05Z")

</div>

I have a multilingual site with `en`, `de`, and `fr` as the available languages. The default language is `en` as I have configured in the `config.yaml` file:

```auto
defaultContentLanguage: "en"

```

I want the logo inside the navigation bar to redirect to the homepage or my site. However, by using the following snippet, when the current language is the default one (`en`), the the generated link is `localhost/en`.

```auto
<a class="navbar-item" href="/{{ $.Site.Language }}">

```

I want it to be `localhost` when the current language is the default one and `localhost/de` and `localhost/fr` respectfully for the other languages.

How can I access the `defaultContentLanguage` setting in order to do something like this?

```auto
<a class="navbar-item"
    href="/{{ if ne .Site.Language.Lang .Site.defaultContentLanguage }}{{ $.Site.Language }}{{ end }}">

```

The related issue I found is this one, but I didn’t find an answer:

> [@Is there a way to retrieve the value of defaultContentLanguage?](https://discourse.gohugo.io/t/is-there-a-way-to-retrieve-the-value-of-defaultcontentlanguage/9643):
>
> It can help to make more flexible default templates for multilanguage sites (e.g. hreflang link attributes in html headers).

---

<div class="post-metadata">

**Author:** ![martignoni](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/martignoni/32/5756_2.png) [@martignoni](https://discourse.gohugo.io/u/martignoni)\
**Post date:** [June 13, 2018, 4:11pm UTC](https://discourse.gohugo.io/t/solved-how-to-fetch-the-defaultcontentlanguage-setting-in-a-template/12397/2 "2018-06-13T16:11:44Z")

</div>

> [@nop33](#):
>
> I want the logo inside the navigation bar to redirect to the homepage or my site. However, by using the following snippet, when the current language is the default one ( `en` ), the the generated link is `localhost/en` .
> 
> ```auto
> <a class="navbar-item" href="/{{ $.Site.Language }}">
> 
> ```

If I understand correctly what you want, you may use something like:

```auto
<a class="navbar-item" href="{{ .LanguagePrefix | absURL }}">

```

Have a look at my site (same languages as yours) here:

> **[GitHub - moodlebox/moodlebox.net: The MoodleBox website](https://github.com/moodlebox/moodlebox.net)**
>
> The MoodleBox website. Contribute to moodlebox/moodlebox.net development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![nop33](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nop33/32/6177_2.png) [@nop33](https://discourse.gohugo.io/u/nop33)\
**Post date:** [June 13, 2018, 6:51pm UTC](https://discourse.gohugo.io/t/solved-how-to-fetch-the-defaultcontentlanguage-setting-in-a-template/12397/3 "2018-06-13T18:51:00Z")

</div>

Yes, thank you!

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [June 13, 2018, 10:01pm UTC](https://discourse.gohugo.io/t/solved-how-to-fetch-the-defaultcontentlanguage-setting-in-a-template/12397/4 "2018-06-13T22:01:28Z")

</div>

I think it also helps to know that there is one site per language and the sites are ordered (by weight etc. from your config).

So, to link to the first site/language:

```bash
<a class="navbar-item" href="{{ $.Sites.First.Home.RelPermalink }}">

```
