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


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:

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.

<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?

<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:


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

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

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


Yes, thank you!


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:

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