I find that since I started using Hugo, the default language pages appear at the root of the public directory. Is this the default behaviour if someone wants them to appear at the domain root without language prefix? I thought them appearing in their own language subdirectory for organisation purposes would be better.
Yes,
defaults
hugo config --printZero | grep -i tLanguage
defaultcontentlanguage = 'en'
defaultcontentlanguageinsubdir = false
disabledefaultlanguageredirect = false
guess hugo evolved from single site to multisite and multisite was an adddon… maybe you’ll get a statement here from development core.
it’s a one shot setting for the ones that don’t like it ![]()
That one ads /en/ to the domain. Hugo Docs is using the same structure but no language prefix added…
mmh…maybe we talk about different things
- single language
http://example.com
- singe language in subdir
http://example.com/subdir- or
http://example.com/en
- multilang default
http://example.com← defaulthttp://example.com/de
- multilang with default in subdir
http://example.com← redirect to defaulthttp://example.com/enhttp://example.com/de
- multihost multilang
http://en.example.comhttp://de.example.com
hugo docs for me is the first variant. What are you looking for?
That, but in this format
multilang with default in subdir
* `http://example.com`
* `http://example.com/en` ← redirect to default
* `http://example.com/de`
if your default content is in content/en
> tree content
├───de
│ └───posts
│ └───post-3
└───en
└───posts
└───post-3
> tree /f public
├───de
│ │ index.html
│ │
│ └───posts
│ │ index.html
├───en
│ index.html <- ALIAS
│
└───posts
│ index.html
baseURL = 'https://example.org/'
defaultContentLanguage = 'en'
defaultContentLanguageInSubdir = false
disableDefaultLanguageRedirect = false
disableKinds = ['sitemap', 'rss', 'taxonomy', 'term']
# -----------------------------------------------------------------------------
# Languages
# -----------------------------------------------------------------------------
[languages.en]
contentDir = 'content/en'
languageCode = 'en-US'
languageDirection = 'ltr'
languageName = 'English'
title = 'My New Hugo Site (en)'
weight = 1
[languages.de]
contentDir = 'content/de'
languageCode = 'de-DE'
languageDirection = 'ltr'
languageName = 'Deutsch'
title = 'My New Hugo Site (de)'
weight = 2
if your default content is in /contentand the others in subdirs is
change these
[languages.en]
contentDir = 'content'
├───content
│ ├───de
│ │ └───posts
│ │ └───post-3
│ └───posts
│ └───post-3