Listing Section sub-sections and titles

I’ve searched for quite a while, and even saw a few close topics (like List subsections pages and titles in list.html), but haven’t found what I need here (or anything in the Docs (that I can interpret):

I want to list posts from sub-sections on one page, grouped by sub-section, with a sub-section title.

Content looks like:

content/
|
+- accessibility/
|  |
|  +- _index.md
|  +- a11y-list/
|    |
|    +- _index.md
|    +- global/
|    |    |
|    |    +- _index.md
|    |    +- gpost1.md
|    |    +- gpost2.md
|    +- keyboard/
|    |    |
|    |    +- _index.md
|    |    +- gpost1.md
|    |    +- gpost2.md

I have _index.md inside of every sub-folder (I’ll want to have list views for all levels). I’m unable to return anything other than just the links to the ‘global’ and ‘keyboard’ sections.

To reiterate, I am looking to have the a11y-list page show posts from global and keyboard, grouped by those respective section headings.

Gah, it’s as easy as

{{ range .Sections }}
{{ .Title }}
<ul>
    {{ range .Pages }}
    <li>
    <a href="{{ .Permalink }}">{{ .Title }}</a>
    </li>
    {{ end }}
</ul>
{{ end }}
1 Like

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