[SOLVED] Hugo multilingual setup assistance needed!


Completely new to hugo. I’ve decided to go with distributed content into own content dirs (contentDir setting), since content will differ from language to language. Say, we have 2 languages “en”, “es”

My content looks like this:

+-- en/
    +-- news/
        +-- _index.md
        +-- news1.md
+-- es/
     +-- news/
        +-- _index.md
        +-- news1.md

The point is, news is not being generated at all. I’m compiling with -D flags. I do not use a theme. I have created _default/list.html and _default/signle.html layouts.

My problem, is that I can navigate to /en or /es urls, but not to /en/news or /es/news. It’s not compiled.

Can anyone point out what I am missing?
Thank you.

Do you have a repo you can share?


Thanks! Sure, there: https://github.com/mr-moon/hugo-ml-test

I’ve got the same layout than yours (see https://github.com/moodlebox/moodlebox.net).

You’ve to add in your layout folder a news/single.html template, to get layout/news/single.html. If I’ve understood Hugo (still a newbie too), your news should be generated.

Thanks, great site you have out there!

Tried it - same problem. The only difference I noticed, is that you don’t have content/en/index.md. So I removed it, and I got the news section to render.


Can anyone explain this?

With my limited knowledge, I understand, that if index.md is present, the section is considered as a leaf bundle and nested content is then ignored. However, I’m missing out the point, if manually put the _index.md into the nested section of a leaf bundle it should that section as a branch bundle, no?

I’m a bit confused.

/me went reading https://gohugo.io/content-management/page-bundles/ one last time

Oh actually, by the great Trial and Error path i discovered, that having an index.md file in a section triggers that section to be rendered as a single page using single.html layout with content from index.md. Now, having _index.md does the same, but switches to the list.html layout. Eureka!