Tags, and a tag cloud
With more than a dozen posts, a list sorted by date stops being a good way to find things. Every post now has a few tags, and the tag cloud shows them all at once.
Turning them on#
Hugo supports tags out of the box, but this site had switched them off, because there was nothing to put on those pages yet. Turning them on is a few lines in hugo.toml:
[taxonomies]
tag = "tags"
Only tags, no categories: two ways of grouping posts would mostly say the same thing twice.
A post lists its tags in its front matter:
tags: ["ci", "reliability"]
A small vocabulary#
Tags only help if they repeat. I keep them lowercase and short, and I reuse an existing tag before inventing a new one. A tag that only one post will ever carry is mostly noise.
A cloud without inline styles#
A tag cloud shows tags that have more posts in a bigger size. The usual way to build one is to set a font size on each tag, but this site’s security policy blocks inline styles. So the theme sorts every tag into one of five steps, and the stylesheet sets the size for each step:
step = 1 + floor((posts - fewest) × 4 / (most - fewest))
The most-used tags come out largest, bold and in amber.
What you get#
/tags/: the cloud, with the number of posts next to each tag./tags/<tag>/: every post with that tag, newest first.- An RSS feed per tag, at
/tags/<tag>/index.xml, if you only want to follow one subject. - The tags of each post at the end of the post and next to it on the home page.