Site.Sections is empty

I am struggling with an empty response when I call .Site.Sections. I call this in /layouts/index.html. My Sections are under the content dir (directory target_groups en working_methods).

When I save a file in one of my Sections, they ‘appear’ in the Sections list (when I run ‘hugo server’). When I just run ‘hugo server’ the .Sections (.Site.Sections) are empty. What am I doing wrong? These are folders under the content dir, so a Section… right? Adding an empty _index.md file in these folders helps when I am running Hugo, but not when I do a clean restart of Hugo. Feels like a bug, but this is so essential that I must be missing something.

Thank you in advance for your help!!!

It seems like the index.md file in the root of content was preventing Hugo to see the subdirectories of content as sections. Changing the ‘index.md’ file to ‘_index.md’ worked mysteriously.

This is not in line with the documentation and feels like a bug to me.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.