[SOLVED] Failing to generate multilingual site

Hey guys, I have a multilingual site and I’m not able to generate it.
It seems that every time I run the build command it fails with a bunch of warning in the console. But ones in 8-10 attempts it generates the correct output.

Can someone write me what I’ve done wrong pls? Thank you!

Steps to reproduce

  1. Clone the https://github.com/sklar/test-hugo
  2. Run hugo until you get the correct output

Correct output

➔ hugo --ignoreCache

                   | CS | EN
+------------------+----+----+
  Pages            |  5 |  4
  Paginator pages  |  0 |  0
  Non-page files   |  0 |  0
  Static files     |  0 |  0
  Processed images |  0 |  0
  Aliases          |  1 |  1
  Sitemaps         |  0 |  0
  Cleaned          |  0 |  0

Total in 34 ms

or verbose mode

➔ hugo --verbose
INFO 2018/04/05 21:58:20 Using config file: /Users/sklar/Workspace/Projects/test-hugo/config.toml
Building sites … WARN 2018/04/05 21:58:20 Unable to find Static Directory: /Users/sklar/Workspace/Projects/test-hugo/static/
WARN 2018/04/05 21:58:20 No static directories found to sync
INFO 2018/04/05 21:58:20 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
INFO 2018/04/05 21:58:20 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
INFO 2018/04/05 21:58:20 Alias "en" translated to "en/index.html"
INFO 2018/04/05 21:58:20 Alias "en" translated to "en/index.html"

                   | CS | EN
+------------------+----+----+
  Pages            |  5 |  4
  Paginator pages  |  0 |  0
  Non-page files   |  0 |  0
  Static files     |  0 |  0
  Processed images |  0 |  0
  Aliases          |  1 |  1
  Sitemaps         |  0 |  0
  Cleaned          |  0 |  0

Total in 43 ms

Incorrect output

➔ hugo --ignoreCache

                   | EN | CS
+------------------+----+----+
  Pages            |  0 |  0
  Paginator pages  |  0 |  0
  Non-page files   |  0 |  0
  Static files     |  0 |  0
  Processed images |  0 |  0
  Aliases          |  1 |  1
  Sitemaps         |  0 |  0
  Cleaned          |  0 |  0

Total in 28 ms

or verbose mode (shortened)

➔ hugo --verbose
INFO 2018/04/05 21:59:16 Using config file: /Users/sklar/Workspace/Projects/test-hugo/config.toml
Building sites … WARN 2018/04/05 21:59:16 Unable to find Static Directory: /Users/sklar/Workspace/Projects/test-hugo/static/
WARN 2018/04/05 21:59:16 No static directories found to sync
INFO 2018/04/05 21:59:16 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
INFO 2018/04/05 21:59:16 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
INFO 2018/04/05 21:59:16 Alias "en" translated to "en/index.html"
WARN 2018/04/05 21:59:16 [en] Unable to locate layout for "page": [page/single.en.html.html theme/page/single.en.html.html page/single.html.html theme/page/single.html.html page/single.en.html theme/page/single.en.html page/single.html theme/page/single.html _default/single.en.html.html theme/_default/single.en.html.html _default/single.html.html theme/_default/single.html.html _default/single.en.html theme/_default/single.en.html _default/single.html theme/_default/single.html]
..

                   | EN | CS
+------------------+----+----+
  Pages            |  0 |  0
  Paginator pages  |  0 |  0
  Non-page files   |  0 |  0
  Static files     |  0 |  0
  Processed images |  0 |  0
  Aliases          |  1 |  1
  Sitemaps         |  0 |  0
  Cleaned          |  0 |  0

Total in 26 ms

Environment

Hugo Static Site Generator v0.38 darwin/amd64 BuildDate:
GOOS="darwin"
GOARCH="amd64"
GOVERSION="go1.10.1"

You need one or more layout files (or a theme).

mm so those defaults are not enough? :thinking:
https://github.com/sklar/test-hugo/tree/master/src/layouts/_default

They are, but you have to tell Hugo where they are.

I’m sorry @bep, I’m lost… how can I do that please?
I’ve thought it’s set in config.toml by this line:
layoutDir = "src/layouts"

or it has to be (along with static dir) set per language as I can see in the hugo config output this

languages = map[en:map[description: contentdir:src/documents/en languagename:English] cs:map[contentdir:src/documents/cs description: metadataformat:yaml languagename:Česky layoutdir:src/layouts]]
languagessorted = [en cs]
layoutdir = "layouts"

So if I set the layoutDir for every language then it works :no_mouth:
Here is the diff

But I’m confused, I’d expect that it’s inherited…
what other dirs should be set for every language pls? staticDir only?

Thanks for your time! :vulcan_salute:

You need to read the TOML spec. Only maps can follow maps. In an ideal world, Hugo should have warned you about this, but that is not easy.