I’m sure this probably been asked a thousand times but I can’t find a solution for it. I’ve got content that is 3 levels deep in the content
folder and I’m trying to loop over the current pages in its .Section
but it appears to always return blank. All folders have _index.md
files which I believe makes them a section:
content
├── _index.md
├── contact.md
├── docs
│ ├── _index.md
│ ├── general.md
│ └── v1
│ ├── _index.md
│ ├── examples
│ │ ├── _index.md
│ │ └── word.md
│ └── endpoints
│ ├── _index.md
│ └── geo.md
├── privacy.md
└── tos.md
I’ve got the current little snippet:
<div class="tabs">
<ul>
{{ range where .Site.Pages "Section" .CurrentSection }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</div>
But it always returns blank without anything inside the list. If I remove the .CurrentSection
filter (range .Site.Pages "Section"
) it works but returns everything from under the docs
portion of the file tree.
I seem to recall this being the intended functionality but I can’t find anything in the docs pointing to this being true.
Basically, I’m wanting it to return everything at its current level in the tree. At the bottom level it’d return everything under the endpoints
level, in the examples folder it’d return everything in there etc.