I just started using Hugo with the Gokarna theme for my blog. Having seen multiple examples of TILs (“Today I Learned”) I also wanted to create a small corner on my blog for TIL-type content. However, Gokarna doesn’t support it by default.

So, here’s what I did to achieve proper separation.

  1. Create a new content folder in /content/tils to store your TIL markdown files.
  2. Add a menu item in your hugo.toml file to include the TIL section in the menu at the top right.
[[menu.main]]
    name = "TILs"
    url = "/tils/"
    weight = 2
  1. Add the til: true front matter to your TIL files.
---
title: "How to separate TILs from Posts in Hugo's Gokarna theme"
date: 2025-02-14
type: "post"
til: true
---
  1. Update the layouts/index.html file in the Gokarna theme to exclude TILs from the posts list. Change this:
{{ $posts := where .Site.RegularPages "Params.type" "post" }}

To this:

{{ $posts := where (where .Site.RegularPages "Params.type" "post") "Params.til" "ne" true }}

I’m sure there is a more elegant solution where you don’t need to add the extra til: true metadata tag to each TIL-type post, but it was quick enough to change and it works.