Listing all pages within sub-directories

Hi everyone, I currently have a content structure like this:

content/
    folder-a/
        _index.md
        subfolder-a/
            _index.md
            post-1.md
            post-2.md
            post-3.md
        subfolder-b/
            _index.md
            post-1.md
            post-2.md
            post-3.md

When visiting the URL mysite.com/folder-a/ I would like to see all the post inside both subfolder-a and subfolder-b listed excluding the content in _index.md

What would the range loop look like the above, would I have to rely on tags and categories and do a .Site.Pages where to get the list of pages Iā€™m looking for?

You can do something like:

{{ $section := site.GetPage "folder-a" }}
{{ range $section.RegularPagesRecursive }}
{{ end }}
3 Likes

Great thank you so much for that!

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