Default language in both root and subfolders

#1

Default language of my sites is “en”, but I still want a subfolder en(www.my-site.com/en) that also shows English content. I’ve tried DefaultContentLanguageInSubdir, but in /en folder, Hugo only generates an index.htm and redirect to / . Is it any way to achieve this goal?

www.my-site.c om/ -> English
www.my-site.c om/en -> English
www.my-site.c om/es -> Spanish
www.my-site.c om/jp -> Japanese

Thanks a lot!


here is my language configs:

DefaultContentLanguage = “en”
DefaultContentLanguageInSubdir = true
[languages]
[languages.en]
languageName = “English”
[languages.es]
languageName = “Español”
[languages.jp]
languageName = “日本語”

#2

You must be doing something wrong, because the config you share here is correct. However, it’s difficult to say more. Share your project if you want more help.

1 Like
#3

I think if you want to go this route, you’ll need two English language configurations. One that renders at the website root (example.com/) and the other set to render in a subdirectory (example.com/en/) with the defaultContentLanguageInSubdir setting.

From my experience it’s not possible to have both the English render at the root and in a subdirectory. I don’t think Hugo can render such duplicate content without also duplicating the English language setting.