garden/layouts/taxonomy/tag.terms.html
Vigilio Desto b610f20797
Weighted tag cloud: size reflects piece count (garden#9)
Custom taxonomy template: tags sorted by count, font-size
scaled 80-200% based on weight. Heavy tags (essay: 29) are
large and violet. Light tags are small and faint. Mono font,
flex-wrapped, breathable spacing.

Replaces the flat card grid on /tags/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 19:30:54 +02:00

27 lines
946 B
HTML

{{ define "main" }}
<section>
<header>
<h1>Themes</h1>
<p data-text="dim">{{ len .Data.Terms }} threads running through the garden</p>
</header>
<div class="tag-cloud">
{{- $max := 0 -}}
{{- range .Data.Terms.Alphabetical -}}
{{- if gt .Count $max }}{{ $max = .Count }}{{ end -}}
{{- end -}}
{{- range .Data.Terms.ByCount -}}
{{- $weight := div (mul .Count 100) $max -}}
{{- $size := add 80 (div (mul $weight 120) 100) -}}
<a href="{{ .Page.RelPermalink }}"
class="tag-weight"
style="font-size: {{ $size }}%{{ if ge $weight 60 }}; color: var(--garden-dialogue){{ else if ge $weight 30 }}; color: var(--garden-text-dim){{ else }}; color: var(--garden-text-faint){{ end }}"
title="{{ .Count }} {{ if eq .Count 1 }}piece{{ else }}pieces{{ end }}">
{{ .Page.Title }}
<small>{{ .Count }}</small>
</a>
{{- end }}
</div>
</section>
{{ end }}