Christopher Chelpka

How to Change the Order of Posts in a Category (Micro.blog + Hugo)

Like most blog themes, my current theme uses reverse chronological order to display posts. Newest posts show first.

I like this, but I wanted the opposite to happen when the posts are displayed as part of a category. This would allow me to create blogchains (like these) where readers could read a series of posts in the order in which they were written.

Happily, blogs hosted on Micro.blog can customize their themes. Here’s I did that to display category posts with the oldest posts showing first.

  1. Find the custom templates custom theme.

  2. In the config.json file, between the first and last curly brackets in the file, add the following:

     "taxonomies": { 
        "category": "categories"
        }
    
  3. Click “Create New Template”

  4. Add the following file name and code, then click “Update Template”:

a template Page at Micro.blog

I figured this out using the following Hugo help pages. They also explain how you can order your posts in other ways, such as alphabetically or by length.