From 8be2d3eaf8f1fa83d6b3ed4d1c9d1e73b7cbe78b Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Fri, 10 Sep 2021 19:23:22 +0100 Subject: Add new files to theme --- layouts/partials/tagcloud.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 layouts/partials/tagcloud.html (limited to 'layouts/partials/tagcloud.html') diff --git a/layouts/partials/tagcloud.html b/layouts/partials/tagcloud.html new file mode 100644 index 0000000..0326dc9 --- /dev/null +++ b/layouts/partials/tagcloud.html @@ -0,0 +1,21 @@ +
+ {{ if ne (len $.Site.Taxonomies.tags) 0 }} + {{ $largestFontSize := 1.4 }} + {{ $smallestFontSize := 1.0 }} + {{ $fontSpread := sub $largestFontSize $smallestFontSize }} + {{ $max := add (len (index $.Site.Taxonomies.tags.ByCount 0).Pages) 1 }} + {{ $min := len (index $.Site.Taxonomies.tags.ByCount.Reverse 0).Pages }} + {{ $spread := sub $max $min }} + {{ $fontStep := div $fontSpread $spread }} + {{ range $name, $taxonomy := $.Site.Taxonomies.tags }} + {{ $tagCount := len $taxonomy.Pages }} + {{ $currentFontSize := (add $smallestFontSize (mul (sub $tagCount $min) $fontStep) ) }} + {{ $weigth := div (sub (math.Log $tagCount) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }} + {{ $currentFontSize := (add $smallestFontSize (mul (sub $largestFontSize $smallestFontSize) $weigth)) }} + + {{ $name }}{{ $tagCount }} + + {{ end }} + {{ end }} +
-- cgit