Can Hugo mark the current language for all pages?

Hi, I have a problem with the multilingual mode. By changing the pages, the language set to default language. Can Hugo mark the current language for all pages?

<select id="select-language" onchange="location = this.value;" class="language-selector">
	{{ $siteLanguages := .Site.Languages}}
	{{ $pageLang := .Page.Lang}}
	{{ range .Page.AllTranslations }}
	  {{ $translation := .}}
	  {{ range $siteLanguages }}
	    {{ if eq $translation.Lang .Lang }}
	      {{ if eq $pageLang .Lang}}
	        <option id="{{ $translation.Language }}" value="{{ $translation.URL }}" selected>{{ .LanguageName }}</option>
	      {{ else }}
		<option id="{{ $translation.Language }}" value="{{ $translation.URL }}">{{ .LanguageName }}</option>
	      {{ end }}
	    {{ end }}
	  {{ end }}
	{{ end }}
</select>

I have a section with English content.
section _index.md frontmatter:

+++

[[cascade]]
Language = "en"
+++

more hee

How and where you are linking your pages?

Because using .Permalink / .Relpermalink would give you the URL of the current language.

You could also use relLangURL / absLangURL

Inside your posts you can use the ref / relref shortcode, like so:

[Link]({{<relref "some-page">}})

And it would also give you the correct URL of the selected language.

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