1 {{ if $.Site.Taxonomies.tags }}
2 {{- if not (eq (len $.Site.Taxonomies.tags)
0) -}}
3 {{- $fontUnit :=
"rem" -}}
4 {{- $largestFontSize :=
2.0 -}}
5 {{- $largestFontSize :=
2.5 -}}
6 {{- $smallestFontSize :=
1.0 -}}
7 {{- $fontSpread := sub $largestFontSize $smallestFontSize -}}
8 {{- $max := add (len (index $.Site.Taxonomies.tags.ByCount
0).Pages)
1 -}}
9 {{- $min := len (index $.Site.Taxonomies.tags.ByCount.Reverse
0).Pages -}}
10 {{- $spread := sub $max $min -}}
11 {{- $fontStep := div $fontSpread $spread -}}
14 <h3>here we talk about..
</h3>
15 {{- range $name, $taxonomy := $.Site.Taxonomies.tags -}}
16 {{- $currentTagCount := len $taxonomy.Pages -}}
17 {{- $currentFontSize := (add $smallestFontSize (mul (sub $currentTagCount $min) $fontStep) ) -}}
18 {{- $count := len $taxonomy.Pages -}}
19 {{- $weigth := div (sub (math.Log $count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) -}}
20 {{- $currentFontSize := (add $smallestFontSize (mul (sub $largestFontSize $smallestFontSize) $weigth) ) -}}
21 <!--Current font size: {{$currentFontSize}}-->
22 <a class=
"tag-cloud-link" href=
"{{ "/tags/
" | relLangURL }}{{ $name | urlize }}" style=
"font-size:{{$currentFontSize}}{{$fontUnit}}">{{ $name }}
</a>
28 <p>here will appear the tag cloud as soon as we have tags :)
</p>