summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'themes/danix-xyz-hacker/layouts')
-rw-r--r--themes/danix-xyz-hacker/layouts/partials/tag-cloud.html21
1 files changed, 8 insertions, 13 deletions
diff --git a/themes/danix-xyz-hacker/layouts/partials/tag-cloud.html b/themes/danix-xyz-hacker/layouts/partials/tag-cloud.html
index 0d59e3c..0db75f0 100644
--- a/themes/danix-xyz-hacker/layouts/partials/tag-cloud.html
+++ b/themes/danix-xyz-hacker/layouts/partials/tag-cloud.html
@@ -22,16 +22,12 @@
{{/* 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 -}}
@@ -55,15 +51,14 @@
{{- 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 -}}