New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to enable multilingual mode? #13
Comments
It is not against the minimalist idea. Hugo has the multilingual mode and I believe you can use this mode, but it is probably not what you want for a bilingual blog: https://gohugo.io/content-management/multilingual/ Perhaps it is just that I don't understand it correctly, but I feel Hugo's multilingual mode is for translations of the same posts. If that is what you meant by "bilingual", please go ahead and use it. If you want two independent blogs with different languages, it is a little more complicated and I don't have time to explain how it may work -- you may study the source code of my own website: https://github.com/rbind/yihui (TL;DR my website is fairly complicated) |
Sorry I didn't make it clear. What I want is a single blog, of which the main language is Chinese. And sometimes, for language practice purpose, I may translate some of the posts into English or simply write an independent English post. That's what I mean by bilingual. Perhaps I have used the wrong word. I have checked https://gohugo.io/content-management/multilingual/ But I think this multilingual mode requires support from the theme level. Will look into it again when available. |
I read through that page, and as instructed, created /partials/translations.html: {{ if .IsTranslated }}
{{ i18n "translations" }}
{{ range .Translations }}
<li><a href="{{ .Permalink }}">{{ .Lang }}</a></li>
{{ end }}
{{ end }} And then added a single line to /theme/hugo-xmin/layouts/partials/header.html to make it like this: <body>
<nav>
<ul class="menu">
{{ range .Site.Menus.main }}
<li><a href="{{ .URL | relURL }}">{{ .Name }}</a></li>
{{ end }}
{{ partial "translations.html" . }} # Added by me.
</ul>
<hr/>
</nav> At last, made some changes to /config.toml. Not sure if that's the right way as I'm not very familiar with HTML and hugo, though the pages look good. I also wonder if there is another workaround that requires no change to files under the theme folder. Thanks for your time. |
That looks good to me. |
I'm trying to open a bilingual blog recently. And please forgive my stupid request if you think it's against the minimal idea of this theme.
The text was updated successfully, but these errors were encountered: