How to get a pages from specific folder (not all) with dict?

About this post:

There is a string: {{ partial "menus/section.html" (dict "page" . "pages" site.Sections) }}
I trying to get there not all pages from site, but from specific folder (“docs”). How to do it? Trying to use something like site.Section "docs" instead of site.Sections, but it is does not works.


The pages argument needs to be a page collection.

{{ $pages := (site.GetPage "/docs").Pages }}
{{ partial "menus/section.html" (dict "page" . "pages" $pages }}
1 Like

Thank you
And if I need to remove a specific page from the menu?
I am trying something like {{- if not .Params.exclude}}, but then child elements are also not included in the list

If you exclude a section, you will not be able to “walk” its descendants.

1 Like