Get a list page in a nested section, consisting of tags from the blog section

content/projects/other-projects/_index.md

+++
title = 'Other projects'
date = 2024-01-08T10:51:03-08:00
draft = false
layout = 'blogs-tagged-other-projects'
+++

layouts/_default/blogs-tagged-other-projects.html

{{ define "main" }}
  <h1>{{ .Title }}</h1>
  {{ .Content }}
  {{ $p := where site.RegularPages "Section" "blog" }}
  {{ $p = where $p "Params.tags" "intersect" (slice "other-projects") }}
  {{ range $p }}
    <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
  {{ end }}
{{ end }}

https://gohugo.io/templates/lookup-order/#target-a-template
https://gohugo.io/functions/collections/where/

1 Like