X-Git-Url: https://git.danix.xyz/?a=blobdiff_plain;f=layouts%2Fpartials%2Ftag-cloud.html;fp=layouts%2Fpartials%2Ftag-cloud.html;h=9f7b060a7162d09bc855d98154e18d9773347ef0;hb=e28a215c266b18d0a3eb7156345f8cdbab3a883b;hp=0000000000000000000000000000000000000000;hpb=213775dddc11bf89506c563df2ead19098d80e08;p=theme-danix.xyz.git diff --git a/layouts/partials/tag-cloud.html b/layouts/partials/tag-cloud.html new file mode 100644 index 0000000..9f7b060 --- /dev/null +++ b/layouts/partials/tag-cloud.html @@ -0,0 +1,30 @@ +{{ if $.Site.Taxonomies.tags }} + {{- if not (eq (len $.Site.Taxonomies.tags) 0) -}} + {{- $fontUnit := "rem" -}} + {{- $largestFontSize := 2.0 -}} + {{- $largestFontSize := 2.5 -}} + {{- $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 -}} + +
+

here we talk about..

+ {{- range $name, $taxonomy := $.Site.Taxonomies.tags -}} + {{- $currentTagCount := len $taxonomy.Pages -}} + {{- $currentFontSize := (add $smallestFontSize (mul (sub $currentTagCount $min) $fontStep) ) -}} + {{- $count := len $taxonomy.Pages -}} + {{- $weigth := div (sub (math.Log $count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) -}} + {{- $currentFontSize := (add $smallestFontSize (mul (sub $largestFontSize $smallestFontSize) $weigth) ) -}} + + {{ $name }} + {{- end -}} +
+ {{- end -}} +{{- else -}} +
+

here will appear the tag cloud as soon as we have tags :)

+
+{{- end -}}