π§© Config file setup
Even if you’re not planning to support multiple languages right now, setting up your blog for multilingual support in advance will make future expansions much easier.
This post uses (Hugo-Theme-Stack by Jimmy).
This post sets up Korean as a main language, English as a secondary language.
Edit config/_default/config.toml like :
|
|
defaultContentLanguage = "ko"declares default content language to Korean.
If your default content Language is Chinese, Japanese, or Korean, you have to set:hasCJKLanguage = true.weightis the index number of the language list.languageNameis the name of the language in the list.subtitleis the profile message of you.- If you want to change page’s title for each language, you can set for each of them with
languages.ko.title.
This is Korean example:
|
|
π How to write multilingual posts and bind them
If you want to write some posts, you have to follow this structure:

|
|
Location of Post file must be content/post/<title>/index.<language-code>.md
Posts that share their slug are binded.
You can write your multilingual test post like this: /content/post/multilingual-test/index.en/md:
|
|
content/post/multilingual-test/index.ko.md would be:
|
|
Now, turn test server on.
|
|

You can go to the translated post!

π Multilingual Setup for sidebars, pages, etc
In English page, you can see that the sidebar is empty.
It is because other content has no translated component.
So, you have to make your translated version of other components(page, content, categories, etc).
Make your translated markdown files in content/.
You can make markdown files like this:

Moreover, if you want to change some built-in translations in this theme, you can make i18n/<lang>.toml and override.
You can check the stack theme’s i18n setup here.
π References
Stack by Jimmicai - config/i18n
Hugo Documnet - content management/multilingual
Hugo Document - configuration/languages