I’m trying out Hugo as a replacement for Wordpress for my personal website/blog. I’d like my blog to be in two languages (Russian and English). Using the multilingual mode generates two separate index pages that list posts — one for Russian, one (under /en/
) for English. I’d like posts in all languages to be shown on the main index page (yes, with duplicates if there’s a post in both) because I might want to write some posts only in English, and others only in Russian. Is there a way to achieve that?
layouts/_default/home.html
{{ range where site.RegularPages "Type" "post" }}
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
{{ with .Translations }}
<p>Translations:</p>
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ end }}
This does show translations for posts that have a version in both languages, but that’s not what I want. Here’s the website I have in mind: Posts - Bert Hubert's writings, btw also made with Hugo according to meta tag, and has posts in both English and Dutch. Doesn’t seem to be using the multilingual mode tho.
So basically I want posts written in Russian to use Russian strings for other elements of the page, and posts written in English use English ones. Other than that, everything should work as if there’s only one language.
It’s fine if what I’m asking for can’t be done, it’s more of a “nice to have” thing.
{{ range site.Home.AllTranslations }}
{{ range .Pages }}
{{ range where .Pages "Type" "post" }}
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
{{ end }}
{{ end }}
{{ end }}
2 Likes
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.