<ul>
{{ range where .Site.Pages "Section" .Section }}
<li>{{ .Title }}</li>
{{ end }}
</ul>
A Sane Guide to Hugo
Hugo is a Static Site Generator
Note
|
Validated for Hugo extended v101 |
Basics
Project structure
Correlation beetween files
Working with themes
Developing a theme
Patterns and best practices
Generating section indexes
From
https://stackoverflow.com/questions/42868110/how-to-list-pages-in-current-section
You need to filter .Site.Pages by section using the where function. Try this:
If you want to avoid empty lists, you can store the slice of section pages in a variable and check its length before you output the ul tags.
{{ $sectionPages := where .Site.Pages "Section" .Section }}
{{ if ge (len $sectionPages) 1 }}
<ul>
{{ range $sectionPages }}
<li>{{ .Title }}</li>
{{ end }}
</ul>
{{ end }}