]> danix's work - danix.xyz-2.git/commitdiff
feat: replace tier-based sizing with continuous scaling in tag cloud
authorDanilo M. <redacted>
Tue, 21 Apr 2026 21:10:48 +0000 (23:10 +0200)
committerDanilo M. <redacted>
Tue, 21 Apr 2026 21:10:48 +0000 (23:10 +0200)
- Compute size per tag: 0.6rem + (count/maxCount) * 1.2rem
- Compute opacity per tag: 0.7 + (count/maxCount) * 0.3
- Color gradient: small tags var(--text-dim), large (>50%) tags var(--accent)
- Remove .tag-tier-* classes, use inline style attributes
- Update sidebar label to use topTags i18n key

themes/danix-xyz-hacker/layouts/partials/tag-cloud.html

index 0d59e3c6708f11e1eb249605a21e189587990c0d..0db75f09b78815f740fd04dfd431045635c1d526 100644 (file)
 {{/* 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 -}}
@@ -41,7 +37,7 @@
 {{/* 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 -}}