I am encountering an issue where if I am on a paginated page of a multilingual site, then the language switcher opens the homepage of the switched to language, not the corresponding paginated page. Is this by design?
I see! So I assume we cannot manipulate this code to return the correct pagination?
{{- if .IsTranslated -}}
{{- with .Translations }}
<ul>
{{ range . }}
<li>
<a hreflang="{{ .Language.LanguageCode }}">{{ .Language.Lang }</a>
</li>
{{- end }}
</ul>
{{- end }}
{{- end }}
The Permalink
and RelPermalink
values of pagers 2-n are always the same as the
Permalink
and RelPermalink
values of pager 1.
You can access the paginator values, but only if you’ve already paginated. See:
https://discourse.gohugo.io/t/pagination-using-pager-values-within-the-head-element/50340
I run a script in your minimal reproducible site to create duplicate book files and rename the copies by adding a language code. I then defined both languages in hugo.toml and added the code switch above, but still the site points to homepage.
This issue is not a big deal for now since the pages behave as expected…
You have to use https://gohugo.io/methods/pager/pagenumber/ or https://gohugo.io/methods/pager/url/.