List all tags, categories

#1

I’m trying to list/loop through all tags used in an entire hugo site. I have taken some time, looking around I got this

{{ range .Site.Taxonomies.tags }}

That doesn’t get me very far though; I’m still outputing some spaghetti mess. It occurs to me that I’m missing something, that could probably be identified quickly. Any links (perhaps even to older questions here) or ideas?

#2

You first: Requesting Help

Please share a repo, so folks can see what you are doing.

#3

my solution

	{{range $name, $taxonomy := .Site.Taxonomies.tags}} {{ $cnt := .Count }}
	  {{ with $.Site.GetPage (printf "/tags/%s" $name) }}
          <div class="tagbutton">
		<a href={{ .RelPermalink }} title="All pages with tag <i>{{$name}}</i>">{{$name}}</a>
		<sup>{{$cnt}}</sup>
          </div>
	  {{end}}
	{{end}}
1 Like
#4

@ju52, thanks a lot man. This worked like a charm. Just what I was looking for.