Hugo iterate pages of section
By Flavio Copes
Learn how to iterate over the pages of a specific section in Hugo using range and a where filter on .Site.Pages to loop the markdown files in that folder.
~~~
I had the need to iterate over the pages of a specific section in Hugo, which means markdown files put inside a folder under content, like content/mysection.
Here’s the code to do that:
{{ range (where .Site.Pages "Section" "mysection") }}
{{ range .Pages }}
{{ .RelPermalink }} - {{ .Title }}
{{ end }}
{{ end }}~~~
Related posts about hugo: