Displaying Pinned Articles at the Top of the List While Using A Theme

Hi everyone,

I’m working on a Hugo site using the Hugo Blog Awesome theme, and I want certain articles to always appear at the top of the list when they have the pinned: true parameter.

All my articles are organized in subfolders, each containing an index.md file:

content/
├── article-1/
│   ├── index.md  (← This is the article file)
├── article-2/
│   ├── index.md

I added pinned: true to my articles, like this (comments not in code):

---
title: "Relationship Between Orders: From 1830 to Today"
date: 2025-02-11
author: "Lövbacken"
pinned: true
description: "Chronological Timeline"
---

I modified my list.html in layouts/_default/list.htmlto try and display pinned articles first:

{{ define "main" }}
<div class="wrapper list-page">
    <header class="header">
        <h1 class="header-title center">{{ .Title }}</h1>
    </header>
    <main class="page-content" aria-label="Content">

       // Pinned articles
        {{ $pinnedPosts := where .Site.RegularPages "Params.pinned" true }}
        {{ if $pinnedPosts }}
            <h2 class="post-year">📌 Pinned Articles</h2>
            {{ range $pinnedPosts }}
                {{ partial "postCard" . }}
            {{ end }}
        {{ end }}

        // Article by years
        {{ range .Site.RegularPages.GroupByDate "2006" }}
        {{ $year := .Key }}
        <h2 class="post-year">{{ $year }}</h2>

        {{ range where .Pages "Params.pinned" "!=" true }}
            {{ partial "postCard" . }}
        {{ end }}

        {{ end }}

    </main>
</div>
{{ end }}
  • The articles do not appear in the “:pushpin: Pinned Articles” section, even though pinned: true is set in the front matter.
  • I tried using .Site.RegularPages and then .Site.Pages, but neither worked.

Am i doing anything wrong ?
Thanks in advance for your help

returns a value of the Pages Params map, so I would guess your frontmatter should be:

---
title: "Relationship Between Orders: From 1830 to Today"
date: 2025-02-11
author: "Lövbacken"
description: "Chronological Timeline"
params:
  pinned: true
---

custom parameters in the global space are deprecated. always use the params: map

also the author should be moved there or replaced with taxonomies, but that would be needed to be supported by the theme.