Is there a way to customise the language URL?

I’ve been trying to find a way to customise the language URL but retaining the correct ISO language code in HTML.


  • Keep the lang="" value correct as per ISO, in this case “ko” for Korean
  • The URL should reflect the commonly known two-letter code: in this case “kr” so it should be domain.tld/kr/

So far, I tried the following:

  1. Add a languageCode per language – the URL changed but so did the lang=""
languageCode = "ko"


  • domain.tld/kr/
  • html lang=“kr”
  1. Add [languages.ko.permalinks] – did not work
	"/" = "/kr/:slug/"
	posts = "/kr/:slug-:year:yearday/"


  • domain.tld/ko/
  • html lang=“ko”
  1. Add baseURL per language – default language URL stopped working
baseURL = "domain.tld"

baseURL = "domain.tld/kr"


  • The default language is now: domain.tld/en/ when hugo is generating the files. However it works fine as “hugo server”.
  • Korean: domain.tld/kr

Anything I missed?

Other details:

  • Theme tested on: hugo-future-imperfect-slim
    – I haven’t tried testing in another site I’m preparing for multilingual which is using a different theme. I got stuck with this one.

Check your configuration file. Does it (outside of the languages section) define a language somewhere as ko? Then change that one to kr and see if it works. The lang-attribute sometimes takes default language settings as a parameter.

Another way: You might have to change the variable that is printed there to the title of your language and then add a parameter to your language configuration languageName = "ko" and use that instead.

It’s not so much an issue with the setup and more an issue, what your themes developer put into the layouts/_default/baseof.html file. You can override it by copying the themes version into your own repo-root/layouts/_default/baseof.html` (same location, just two folders up the directory tree) and add your changes there.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.