Alright, in this post I’m going to show you how to pin posts in Hugo. But before you keep reading, I request you review the template you’re using and ensure it’s going to allow you to pin posts in the first place.

The thing you’re looking for is the index declaration in your index.html.

Example:

{{- define "content" -}}
  <section id="posts" class="posts">
    {{/* (index .Site.Paginate) */}}
    {{- $paginator := .Paginate (where (where .Site.RegularPages "Type" "post") ".Params.hiddenfromhomepage" "!=" true) }}
    {{- range $paginator.Pages -}}
      {{ .Render "summary" }}
    {{ end -}}
  </section>

For instance, in the above snipped, line number four is where you can find the $paginator that will tell you whether you’ll be able to pin posts. If you see mine, you’re good. Most are probably going to do this. If you see anything with “sortby” then you’re probably fucked, because your template is probably forcing your shit to sort by date, rather than just paginate as Hugo does by default.

So, you’ve determined your template will allow you to pin a post. So how do we go about this? Simple. Just add weight: 10 to the YAML of the post you want to pin. Yes, you can pin multiple posts. Yes, you can sort your pinned posts by weight. Good stuff.

---
Title: Post title
weight: 10

So, yeah. That’s it. It’s incredibly simple! Have fun!