halogenica / beautifulhugo

Theme for the Hugo static website generator
Other
1.13k stars 601 forks source link

nav partial: properly link multilingual translation to the permalink #465

Closed alexandra-zaharia closed 1 year ago

alexandra-zaharia commented 1 year ago

For beautifulhugo to properly support multilingual sites, the language links should direct to the same page in the other language, not the home page in the other language.

For illustration, suppose we have a multilingual site with two languages, en and fr. If we are on page example.com/en/a, then clicking on the fr link we get to example.com/fr instead of example.com/fr/a.

With this PR, clicking on the fr link gets us to example.com/fr/a as intended.

It also works as intended with more than 2 languages.

I can provide a test repo of my own if needed but the easiest way to check is with the hugo-multilingual-example repo.