Best practices and/or enhanced support for i18n site
expersso opened this issue · comments
Loving this theme!
I'm trying to add i18n support, but I'm wondering about the best practice for url management. For example, let's say I implement a language switcher in the navbar like this:
<div>
<ul class="language-list">
{{ range $.Site.Home.AllTranslations }}
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
{{ end }}
</ul>
</div>
This works, but it sends the user to the landing page, whereas
I would prefer for it to link to e.g. /nl/about if you click on it while on the about page.
More importantly, I wonder about how to deal with the navbar links defined in data/en/header.yaml
. Do I need to change the urls on all these manually for alternative languages, e.g.
menuitems:
- title: About Us in Dutch
link: nl/about/
- title: Contact us in Dutch
link: nl/contact/
Or is there already support for automating this?
Lastly, could one add sitemap functionality that treats the main language as the canonical reference and lists alternative languages?
Hello, I also use this and love this theme and I am also wondering about this topic. what I did was I added a language link at the header.yaml and whenever someone wants to change the language It goes back to the homepage of that language. This way it would be much more accessible but I guess much more mapping-crosslinking is needed 🫨
I love the theme, it's beautiful, great work!
However, as someone who does not often deal with Hugo and the likes, I am having a hard time to get a simple language switcher in the header menu to work. I like how Hugoplate does it, but I can't manage to port that solution over easily.
What's the best practice to allow the user to switch languages on site?
I'm interested too.
thanks