Can Hugo support multilingual subdirectory site with locale as the first path parameter before the site?

Hi there

We got a site www.example.com which host several sub-sites all multilingual e.g.
www.example.com/en-us/site1 etc.

We want to use Hugo for one of these sites (RootDomain/en-us/Hugosite). We’ve worked a bit trying to get Hugo to render both localized links and static asset links correctly, but can’t achieve this without hardcoding some of the path.

RootDomain/en-us/Hugosite/1stlevelitem (localized link)
RootDomain/Hugosite/css/styles.css (static asset)

Hugo seems to default to: baseurl + language+content, so if we set our Base url to RootDomain/Hugosite =>RootDomain/Hugosite/en-us/1stlevelitem (not working)
RootDomain/ => RootDomain/en-us/1stlevelitem (not working)

We can then set url in frontmatter of the pages to “en-us/Hugosite/1stlevel” and set baseUrl to root domain and then all links to pages works, but static asset links fails unless we prepend the “Hugosite” before the url part, which hinders us from using absolute urls and isn’t pretty.

Could baseUrl support a placeholder for locale ? which would then be removed when referring static items? or is there a clever way to solve this issue ?

Hi,

Could you clarify if I am I understanding you correctly that

  • you are using Hugo to generate only one hugosite
  • this hugosite exists in a subdirectory which corresponds to one language under example.com/
  • the hugosite itself uses only one language

?

If so, could you not treat hugosite as one monolingual site residing in a subdirectory?

baseURL = "http://example.com/en-us/Hugosite/"

Without setting urls in the frontmatter, content/about.md would have a permalink http://example.com/en-us/Hugosite/about/.

Hi
The site supports 20+ languages so unfortunately that approach wont work.

Can you please clarify then?

Is the top RootDomain a multilingual Hugo site? Or are the subdirectories Hugo sites individually?

Rootdomain is not a Hugo site, and all subdirectories are virtual (handled by proxy), hosted in different locations they are a multitude of different sites and services.