[SOLVED] Dynamically filter pages by taxonomy

You only need to follow the steps specified here and see with your own eyes:

Place the following where you please in _default/list.html

{{ range .Site.Taxonomies }}
  {{ range $key, $value := . }}
    {{ if eq (urlize $key) (urlize $.Title) }}
      {{ range $value.Pages }}
        {{ .Title }}{{ .Params.logo }}
      {{ end }}
    {{ end }}
  {{ end }}
{{ end }}

Specify a brands taxonomy in your config and assign it to posts.

Then under /content/brands/ instead of creating an _index.md simply create a taxonomy-term.md e.g. nike.md
Give it a different .Title parameter.
Run hugo server
Visit /brands/nike or whatever.
See and believe!

1 Like