List of Categories is Incomplete

As you can see from this image, I have four categories with posts:

However, my site Archive is only showing the Photos and Links categories. Following is the template code that displays them…what might be happening here?

{{ $list := ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
{{ if gt (len $list) 0 }}
<div class="archive-categories">
	<h3>Categories</h3>
	<ul>
		{{ range $list }}
		<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
		{{ end }}
	</ul>
</div>
{{ end }}

Where are you assigning $list? It’s probably in that assignment. I’d try .Site.Taxonomies (I think).

1 Like

I don’t know why that line wasn’t showing earlier, but I added it (first line):

{{ $list := ($.Site.GetPage "taxonomyTerm" "categories").Pages }}

I basically know nothing about Go or the templating language, so I am flying blind here. So I’m not sure how to use your answer :slight_smile:

ETA: perhaps relevant, the feeds page is also only showing those two categories.

Something is very peculiar. Is your blog actually building right now (check logs at Micro.blog? For example, when I go to https://micro.chrislott.org/categories/books – there’s no page there. I would expect there to be if those posts exist with those categories.

Your code should work as is, so I suspect you recently added additional categories and perhaps the blog hasn’t been rebuilt? You can try a full rebuild from the linked to logs above.

1 Like

That fixed both problems! I’d never noticed that button to rebuild before. Thank you!

Strangely, this problem reoccurred again this morning. I rebuilt the site and it went away. I’ll keep an eye on it, but something strange is going on.

When you create a new post, Micro.blog does not do a full rebuild of your site right away. If you have very few posts in a category, that partial build will mean that those categories may not show up. This is done to make sure your recent posts are up fast and right into the timeline. Eventually, the full build will happen (generally) and then that’ll back fill. That’s why archives are sometimes significantly shorter for a little while after a new post.

Interesting, and good to know. Thanks.

What @jsonbecker said is exactly right, although usually this happens so quickly that you won’t notice. I’ll look at your blog and see if something is tripping it up. There are probably more optimizations we need to make here.