Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (33 sloc) 1.26 KB
<ul class='term-cloud {{- if .Site.Params.settings.noTermCloudShuffle }} no-shuffle{{- end -}}'>
{{- if gt ( len .Data.Terms ) 0 -}}
{{- $maxSize := 2.0 -}}
{{- $minSize := 1.0 -}}
{{- $sizeSpread := ( sub $maxSize $minSize ) -}}
{{- $maxCount := ( index .Data.Terms.ByCount 0 ).Count -}}
{{- $minCount := ( index .Data.Terms.ByCount.Reverse 0 ).Count -}}
{{- $countSpread := ( sub $maxCount $minCount ) -}}
{{- $.Scratch.Set "sizeStep" 0 -}}
{{- if gt $countSpread 0 -}}
{{- $.Scratch.Set "sizeStep" ( div $sizeSpread $countSpread ) -}}
{{- end -}}
{{- range .Data.Terms.Alphabetical -}}
{{- $count := .Count -}}
{{- $sizeStep := ( $.Scratch.Get "sizeStep" ) -}}
{{- $size := ( add $minSize ( mul $sizeStep ( sub $count $minCount ) ) ) -}}
<li>
<a href='{{ $.LanguagePrefix }}/{{ $.Data.Plural }}/{{ .Term | urlize }}' style='font-size:{{ $size }}em'>
{{- with $.Site.GetPage "taxonomyTerm" $.Data.Plural .Term -}}
{{- .Title | lower -}}
{{- else -}}
{{- .Term | lower -}}
{{- end -}}
</a>
</li>
{{- end -}}
{{- else -}}
<span>
{{- $term := ( ( ( i18n .Data.Singular 1 ) | default .Data.Singular ) ) -}}
{{- i18n "noTerm" ( dict "Term" $term ) -}}
</span>
{{- end -}}
</ul>