Showing a non-taxonomy-based list of content at a given URL

I’m sure this has been answered somewhere but I’m having trouble coming up with the right words to search for it in documentation or these forums.

Here’s the short use case:

  • I have a featured key in post frontmatter
  • I want to have a page at <baseURL>/featured that lists posts with featured: true

Note that featured is NOT a taxonomy.

I know how to range over param values. But in what layout template would I create such a thing, and how would I associate it with a specific URL on the site?

Sorry if I’m missing something very obvious. If similar questions have been asked and answered a quick link to them would be much appreciated.



├── posts/
│   ├──
│   ├──
│   └──
└── featured.html


title = 'Featured'
date = 2022-09-28T15:54:19-07:00
draft = false
type = 'posts'
layout = 'featured'


{{ define "main" }}
  <h1>{{ .Title }}</h1>
  {{ .Content }}
  {{ range where (where site.RegularPages "Type" "posts") "Params.featured" true }}
    <h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
  {{ end }}
{{ end }}

Thanks! The layouts/posts part was the key I was missing.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.