Featured post section at top of home page


I’m trying to add an area above the list of posts on my site’s home page that collects the three most recent posts tagged with, in my case, “Pinned.” It wouldn’t show the entire contents of the post, just their linked titles.

This would be akin to the “Subscriber’s Daily Update” section on Stratechery.

I’ve tried following the guidance @jsonbecker gave on the topic named Can a post be “Pinned?”, but to no avail. Not only is it not displaying any filtered posts, the entire div isn’t appearing at all. No h2 text or styling whatsoever.

I’m clearly doing this wrong or leaving something out and would appreciate help with this matter. Here’s what my index.html template page is looking like currently. The area in question is immediately under {{ define "main" }}:

{{ define "main" }}

<div class="featured-text">
  <h2>Featured Posts</h2>
  {{- range first 3 (where .Site.Taxonomies.category.Pinned.Pages) }}
    <a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a>
  {{- end }}

<div class="content list h-feed">

{{ $pages := cond .IsHome .Site.Pages .Pages }}
{{ $paginator := .Paginate (where .Site.Pages.ByDate.Reverse "Type" "post") (index .Site.Params "archive-paginate" | default 25) }}
{{ range $paginator.Pages  }}

  <div class="list-item h-entry">
	{{ if .Title }}
		<a href="{{ .Permalink }}"><h1 class="home-title">{{ .Title }}</h1></a>
	{{ end }}
    <div class="content post e-content">
      {{ .Content }}
    <div class="list-post-date">
      <a href="{{ .Permalink }}" class="u-url"><time class="dt-published" datetime="{{ .Date.Format "2006-01-02 15:04:05 -0700" }}">{{ .Date.Format "Jan 2, 2006" }}</time>  →</a>

{{ end }}


{{ partial "pagination.html" . }}

{{ end }}


I think the range should be:

{{ range first 3 (where .Site.Pages "Params.categories" "Pinned") }}

That got the div and h2 text to appear, so that’s definitely promising!

Unfortunately, I’m still not getting a list of the three most recent posts tagged “Pinned” within that div. I’ve ensured that I have posts associated with that tag, so their absence is still stumping me.

It appears this way now: