Copyright 2025

The Valley of Code

A Flavio Copes project

Hugo iterate pages of section
Hugo iterate pages of section

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 }}

Join my AI Workshop !

The Web Development BOOTCAMP cohort starts in February 2026