Archive categories in Hugo 0.91

Okay, this may require calling in one of the big guns who clearly knows more than me. I’m trying to update Hitchens for 0.91, and I can’t get the categories cloud in the archive page to display anything (it just shows blank). Here’s the current code in question:

{{ $list := ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
		{{ if gt (len $list) 0 }}
			<div class="archive_categories">
				{{ range $list }}
					<p><a href="{{ .Permalink }}">{{ .Title }}</a></p>
				{{ end }}
			</div>
		{{ end }}

Anyone know how to change this in order for it to work with the new version? I’m sure it has something to do with .Site.Pages, but everything I’ve tried has broken horribly. :slight_smile:

The example from the Hugo docs looks quite different. Have you tried starting from this?

1 Like

This works for me.

{{ range $name, $taxonomy := $.Site.Taxonomies.categories }}
	<div class="archive_categories" style="border-bottom: 1px solid lightgray; padding-bottom: 15px; margin-bottom: 30px;">
		<p><a href="{{ "/categories/" | relURL }}{{ $name | urlize }}"> {{ $name }}</a></p>
	</div>
{{ end }}
2 Likes