How to list immediate descendants only?

I have a section, that includes subsections and pages (as page bundles). I want a list.html template to:

  • list subsections
  • list pages in this section (but not in subsections)

However, {{ range .Pages }} brings a flattened list ALL pages below this section, which defies the very purpose of having subsections. I’ve tried a few things, but I do not see anything in the documentation that could make a distinction I’m looking for.

Did I overlook something?

To receive help you need to share a project for us to look at. :slight_smile:

We don’t know what you’ve done. In lieu of code to look at I recommend you read https://gohugo.io/content-management/sections/#section-page-variables-and-methods.

I’ve spent a couple of hours there already. My project is not ready to be shared, I’m afraid :slight_smile:

OK, I rephrase the question. Is .Pages supposed to return the immediate descendants only (subsections and standalone pages in this sections)? If not, how or whether this can be achieved?

.Pages

Collection of regular pages and only first-level section pages under the current list page.

Indeed, I’m blind. OK, I’ll try to put together a simple sample project and see what I’ve messed up.

Hmm… A hugo server restart did the trick, :sunny: LOL