{{/* Early exit if no tags */}}
{{- if $tags -}}
-{{/* Compute max count for tier thresholds */}}
+{{/* Compute max count for continuous scaling */}}
{{- $maxCount := 0 -}}
{{- range $tags -}}
{{- if gt .Count $maxCount -}}{{- $maxCount = .Count -}}{{- end -}}
{{- end -}}
-{{/* Tier thresholds (integer division) */}}
-{{- $tierMedThreshold := div $maxCount 3 -}}
-{{- $tierHighThreshold := mul (div $maxCount 3) 2 -}}
-
{{/* Ordered tag list (descending by count) */}}
{{- $orderedTags := $tags.ByCount -}}
{{- if gt $maxTags 0 -}}
{{/* Render based on placement mode */}}
{{- if $wrapInWidget -}}
<div class="sidebar-widget">
- <p class="sidebar-widget-label"># {{ i18n "tags" }}</p>
+ <p class="sidebar-widget-label"># {{ i18n "topTags" }}</p>
<nav aria-label="{{ i18n "exploreTopics" }}">
<div class="tag-cloud">
{{- else -}}
{{- range $orderedTags -}}
{{- $count := .Count -}}
- {{- $tier := "low" -}}
- {{- if gt $count $tierHighThreshold -}}
- {{- $tier = "high" -}}
- {{- else if gt $count $tierMedThreshold -}}
- {{- $tier = "medium" -}}
- {{- end -}}
+ {{- $ratio := (div (float $count) (float $maxCount)) -}}
+ {{- $size := (add 0.6 (mul $ratio 1.2)) -}}
+ {{- $opacity := (add 0.7 (mul $ratio 0.3)) -}}
+ {{- $color := cond (ge $ratio 0.5) "var(--accent)" "var(--text-dim)" -}}
<a
href="{{ .Page.RelPermalink }}"
- class="tag-cloud-link tag-tier-{{ $tier }}"
+ class="tag-cloud-link"
+ style="font-size: {{ $size }}rem; color: {{ $color }}; opacity: {{ $opacity }};"
aria-label="{{ .Name }}{{- if $showCount }} ({{ i18n "postCount" $count }}){{- end -}}"
>
{{- .Name -}}