Refreshing multilingual site with separate domains

Hi - I’m going to refresh my company site, with the latest Hugo and multilingual capabilities. Currently, I have two config.toml’s, one for each site, with different baseurl’s specified. This is the repo:

For this site, I use two different hugo server commands, specifying two different config.toml’s, so that say localhost:1111 represents English, while localhost:2222 represents Japanese. Same thing for publishing, two different publish commands render with the correct config.toml each, and rsync to the right folder on my web server.

In the current Hugo, reading the (beautiful! new!) docs, it appears I can do a lot more with multilingual features, and include sections in one config.toml for that. Can I put a different baseurl in each language section? I’m asking because it appears the idea is to use subfolders.

No… Or you probably can but the result is undefined.

Thanks @bep. So, the new multilingual features are really only for one site, one domain, with a sub-folder per language?

Let me elaborate a little:

  • A language configuration is a Hugo site configuration, which inherits values from the global section.
  • So they are full blown Hugo sites with this special treat that Hugo creates automatic links between them (.Translations)
  • But currently one or both will be put in a subfolder (/jp) which is also reflected in all the URLs (.Permalink)
  • So, even if you can set a different baseURL for each site (I have not tested, but that does not matter), it will not have the desired effect, as you would end up with https://en.example.com and https://jp.example.com/jp or some variant of that.

That said, what you want would be a natural extension to what we got, i.e. allowing multiple baseURL with each site ending up in its own root below public, i.e. /public/en, /public/jp but the Permalink for the home page would still be https://en.examaple.com/ etc.

This should not too hard, but I can say that this isn’t something I really need at the moment, so I wouldn’t expect it to happen anytime soon.

If you really want the above, your company could consider sponsoring this feature, i.e. pay for my time implementing it. 3 work days would be a slightly liberal estimate. You would get that feature probably within a week or so, and a “Sponsored by …” thank you note in the release notes (probably also with some logo if you have). Contact me via mail if that is interesting (see my GitHub page) and I will get back to you with a quote in Japanese Yen.

A general note to the above: All the features I have added to Hugo up to now has been on my own time, motivated by personal need or “that’s cool” etc, and that will continue. I would never accept a “sponsored feature” that I would not have added without that backing, given enough time. I put this out into the open not just to inform @RickCogley (I could have sent him an email), but I wanted to be really transparent about this.

2 Likes

Thanks @bep, I sent an email.

May be a blessing in disguise, one domain with language subfolders is IMHO better for SEO since all links point to the same root domain :slight_smile:

Everything isn’t about SEO; people (Norwegians, Swedes, Japanese …) are very connected to their domains, so a company doing business in all 3 of them would probably try to get all of example.no, example.se and example.jp. That is currently not possible with the “multilingual mode” in Hugo.

But the “you can also read this article in Spanish” use case is probably best solved with a /es sub folder. And you can do both … If you also get example.com as the “main version”, you can then deploy to that with the above languages as subfolders.

Hmm, I think hreflang tags would take care of SEO if the translations are under different domains. Japanese companies at least, get .co.jp domains for their company (rule is one .co.jp per entity) and, other domains for their other languages for full sites, or, just use a subfolder if for a handful of translated pages.

Although I understand great developers like @RickCogley who owns several domains and want to host the site on different domains, I beg to differ. E.g. .no, .se and .jp can be redirected to corresponding subfolders which also lessens the DNS configurations.
That said, sorry for hijacking the thread Rick!

Not a problem but, I’m certainly no “great developer” :scream:

Which would certainly work, but would hardly be the same for the user. It would then feel like an English site with a Norwegian translation. Fully separated http://example.no and http://example.com etc. would give a different signal.

But @RickCogley – you should think about this from your perspective.

I guess so. One could re-direct traffic, for say, example.co.jp to example.com/jp using some kind of rewrite in an .htaccess or another method. But, I’d rather just have the capability of specifying a separate domain per language, and make sure the hreflang tags are correct. If a client wants separate domains, doing redirects goes against the spirit of the client request, too.

I kind of agree with you. I have a site that falls into the “multiple domain” category – they share the layout and theme, share most content translated, but they have a totally different target audicence (by language) – adding links between them feels natural, but doing redirects would look really odd.

Yeah, agreed, sometimes it’s simply not a 1:1 translation situation.

Whatever floats your boat guys! My suggestion was based on a marketing perspective. Hugo for president!

I hope you keep us updated on this, I am interested in similar functionality for subdomains! Cheers