Tag cloud snippet for Hugo

Photo by C Dustin on Unsplash

Simple solution for tag cloud in your Hugo website.

{{ $tags := $.Site.Taxonomies.tags.ByCount }}
{{ $v1 := where $tags "Count" ">=" 3 }}
{{ $v2 := where $v1 "Term" "not in" (slice "hugo" "tags" "rss") }}
{{ range $v2 }}
{{ if .Term }}
{{ $tagURL := printf "tags/%s" .Term | relURL }}
<a href="{{ $tagURL }}">{{ .Term }} ({{ .Count }})</a>
{{ end }}
{{ end }}

--

--

--

I drink a lot of tea and build beautiful websites. If you are looking to work together or just start a conversation 👉 https://www.ronaldsvilcins.com/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Flash Stock Rom on vivo X6

Download Official Stock Rom For Vivo

How Machine Advertising visualises billions of events per day with ClickHouse

How to write Tetris in Python

What is real-time communication across browsers? What are its applications?

Getting Started With Ansible

Java 6 Download Mac Yosemite

Java 6 Download Mac Yosemite

How to set up Reemo Studio to connect teams to their workstation, while working from anywhere

Working in VR (in GNU/Linux)

The author with a Valve Index VR headset

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ronalds Vilcins

Ronalds Vilcins

I drink a lot of tea and build beautiful websites. If you are looking to work together or just start a conversation 👉 https://www.ronaldsvilcins.com/

More from Medium

Create Interactive Web Card Game Using HTML, CSS, JS And Getting Data From Public API.

Deleting Git branches in bulk

File Creation Automation with Plop

What is package-lock file