Multilingual server mode: disable languages?

I have 5 languages defined. I’ve been running hugo server for local development as:

hugo server -D -F --disableFastRender --baseURL --config ",,,config.toml,,config.en.toml,dev.toml"

This takes about 8 seconds to render.

dev.toml overrides the baseURL values for en and es from domain names to blank. This makes internal links work correctly in server mode.

Whenever I restart hugo server, each language seems randomly assigned to a port. Since I usually only need English, I thought maybe I could speed up rendering and have a consistent port so browser URL memory would always take me to the right page. So I tried:

HUGO_DISABLELANGUAGES="uk ru de es" hugo server -D -F --disableFastRender --baseURL --config "config.toml,config.en.toml,dev.toml"

This takes 14 seconds to render. displays an empty page. No header or footer or content.

I tried copying dev.toml to dev-en.toml and removing the es baseURL override:

HUGO_DISABLELANGUAGES="uk ru de es" hugo server -D -F --disableFastRender --baseURL --config "config.toml,config.en.toml,dev-en.toml"

This takes 22 seconds to render. English displays at with the correct baseURL. Links to single pages work. Category pages have header and footer, but no content.

I assume part of the problem so far is something bep noted when he was planning multilingual server: any content in a language for which no config.toml exists, will have that content rendered under the default language.

So I tried:

HUGO_DISABLELANGUAGES="uk ru de es" hugo server -D -F --disableFastRender --baseURL --config "config.toml,config.en.toml,,,,,dev.toml"

This renders in 2.2 seconds, so it seems to be correctly ignoring all languages except English. However, the display at is once again a blank page.

Am I missing something, or doing something wrong? Or is it not supported to disable languages in server mode?

A secondary question: is it possible to specific which port will be used for which language, to keep it consistent each time hugo server runs?

It will be difficult for folks to debug this without access to a reproducible project. I suggest you create one to share, then I’m sure we’ll get to the bottom of this.

Did you try without putting a port there? Because there is --appendPort (, so I’m not sure how that is trying to write the URL.

Thanks for your reply! Using just --baseURL had the same results for all tests.

Project repository:

Bumping this, and I’ll add the best workaround I’ve found:

If I have a page which exists only in the base EN language, but not in other languages, I can reliably load it on any port such as , and at least get a blank template which still shows the header and footer, and makes it relatively easy to pick English from the language switcher. Better than needing to try each possible port one at a time.

Anyone have a better solution? Such as disabling unwanted languages in server mode, and/or assigning ports to languages for consistency?

I think I solved the problem of random port assignation for languages. I did not have “weight” set for each language. Now that I set weight, the assignation seems consistent.

For ease of correlation, I will set the weights to 13. 14, 15, etc, to match up with ports 1313, 1314, 1315 etc.

I haven’t looked into the particular problem, but I would recommend looking into the recent configDir feature, with environment + pretty strong language support.

Thanks, yes, I am in the middle of exploring that! (Which is how I happened to discover the “weight” fix when I created a simple test site.)

I think the configDir will address my question about disabling languages:

  • config/_default for the languages I always want enabled
  • config/allLanguages for when I want to test with all of them enabled. I’ll add all languages not already in _default here.
  • config/fastDevelopment for a subset of languages I normally test.

I haven’t tested this setup yet, but I believe it will work. I’ll close this topic.