blogamore/layouts/partials/widget/cloud.html

16 lines
906 B
HTML
Raw Normal View History

<div class="tag-cloud d-inline-block m-0 p-0">
{{ $parentLink := ($.Params.Site.GetPage (printf "/%s" .ident)).Permalink }}
{{ $maxCnt := mul 1.0 (index .tax.ByCount 0).Count }}
{{ $minCnt := mul 1.0 (index .tax.ByCount.Reverse 0).Count }}
{{ $div := math.Max 1 (sub $maxCnt $minCnt) }}
{{ range $key, $sites := .tax }}
<!-- add (mul (math.Pow (div $sites.Count $maxCnt) 2.0) 14.0) 8.0 px -->
{{- (printf `<a class="tag-cloud-link m-1 p-1" style="font-size: %.3frem;" href="%s" aria-label="%s %d Einträge">%s<sup>%d</sup></a>`
(add (mul (math.Pow (div (sub $sites.Count $minCnt) $div) 2.0) 0.6) 0.8)
((printf "%s%s" $parentLink $key) | relURL) $key $sites.Count $key $sites.Count
) | safeHTML -}}
<!--<span class="badge">{{ $sites.Count }}</span>-->
{{ end }}
</div>
{{/* https://mertbakir.gitlab.io/hugo/tag-cloud-in-hugo/ */}}