After moving to micro.blog I thought I had fixed my issue of hiding posts from a specific category. However, after looking at my site earlier today I noticed that there were a number of posts showing up repeatedly on my site. I thought it might be due to the code I put in the index.html. After removing the custom index.html I checked my site again and it fixed the problem of repeat posts showing up but it also left me back to square one.

After some digging and help from people at the Hugo discourse and the micro.blog Slack I managed to get it to work properly, with a very easy fix. Here’s what I did.

First I want to show you the code from the index.html for the Arabica theme (the theme I use) to show you the changes I made.

Old Code:


{{ define "main" }}
    <main class="content" role="main">
    {{ $paginator := .Paginate (where .Pages "Type" "post") }}
    <div class="extra-pagination">
      {{ partial "pagination.html" . }}
    </div>
        {{ range $paginator.Pages }}
      {{ .Render "summary" }}
        {{ end }}
    {{ partial "pagination.html" . }}
    </main>
{{ end }}

New Code:


{{ define "main" }}
    <main class="content" role="main">
{{ $paginator := .Paginate .Site.Taxonomies.categories.main 5 }}
    <div class="extra-pagination">
      {{ partial "pagination.html" . }}
    </div>
        {{ range $paginator.Pages }}
      {{ .Render "summary" }}
        {{ end }}
    {{ partial "pagination.html" . }}
    </main>
{{ end }}

As you can see I replaced the code in Line 3 of the default Index.html to:

{{ $paginator := .Paginate .Site.Taxonomies.categories.main 5 }}

which only shows posts in the category of “main”. You can replace “main” with whatever category you want though. This code is meant to show only one specific category you set. You can do something different if you want to show 2 categories.

You will also see that there is a number 5 at the end of that line of code, which means to show only 5 posts per page. For me, I post articles so infrequently that I want to limit the amount of posts it loads so that when people visit my site it can load in a relatively short period of time. Again, you can remove this if you want, or change the number of posts to whatever you want.

I hope this helps for anyone looking to use micro.blog. I thank those who offered me help with this and hope that this post can be shared to others also looking to make similar changes to their micro.blog website.