Range over author pages (taxonomy pages)

Given a site where author pages are setup using an author = "authors" taxonomy, how can we iterate over the author pages and get their content? In this context, an author page should be a taxonomy _index.md list page where taxonomyTerm is author.

Currently, I’m thinking along the lines of:

{{ range (where (where .Site.Pages "Kind" "taxonomy") "taxonomyTerm" "author") }}

but that gives the error:

Error calling where: taxonomyTerm isn't a field of struct type *hugolib.Page

Note that I also attempted to use .Site.Taxonomies.author, however, that doesn’t appear to have the author’s page related to it, only the children (posts etc.).

Any ideas? Thanks!

I use something like this:

{{ $authortaxo := "authors" }}
{{- $authors := where $.Site.Pages "Section" $authortaxo -}}
{{- range $authors -}}
  {{ . }}
{{ end }}

on authors defined like this:

content/authors/
β”œβ”€β”€ ipsum-author
β”‚   └── _index.md
β”œβ”€β”€ lorem-author
β”‚   └── _index.md
└── pointy-far
    └── _index.md
2 Likes

I didn’t realise that taxonomies can also be treated as normal sections.

@pointyfar thanks a lot for the super fast response and elegant solution :+1: