tag cloud con font size variabile e soglia minima
All checks were successful
Linting markdown on PR / unicode-check (pull_request) Successful in 1m24s
All checks were successful
Linting markdown on PR / unicode-check (pull_request) Successful in 1m24s
This commit is contained in:
parent
d929c605a8
commit
cb64ffe02c
@ -2,9 +2,46 @@
|
|||||||
{{- $hiddenTags := slice "Linuxday-Featured" -}}
|
{{- $hiddenTags := slice "Linuxday-Featured" -}}
|
||||||
<h3>Tags</h3>
|
<h3>Tags</h3>
|
||||||
<ul class="tags-sidebar">
|
<ul class="tags-sidebar">
|
||||||
{{ range where .Site.Taxonomies.tags ".Page.Section" .Section }}
|
|
||||||
{{ if not (in $hiddenTags .Page.LinkTitle ) }}
|
{{ $font_min := 1.0 }}
|
||||||
<li><a href="/{{ .Page.Lang }}{{ .Page.Path }}">{{ .Page.LinkTitle | safeHTML }}</a></li>
|
{{ $font_max := 3.5 }}
|
||||||
|
{{ $count_min_display := 3 }}
|
||||||
|
|
||||||
|
{{ $tags := where .Site.Taxonomies.tags ".Page.Section" .Section }}
|
||||||
|
{{ $tags := where $tags ".Page.LinkTitle" "not in" $hiddenTags }}
|
||||||
|
{{ $count := len $tags }}
|
||||||
|
|
||||||
|
{{ $count_min := -1 }}
|
||||||
|
{{ $count_max := -1 }}
|
||||||
|
|
||||||
|
{{ range $tags }}
|
||||||
|
{{ $c := len .Pages }}
|
||||||
|
{{ if gt $c $count_max }}
|
||||||
|
{{ $count_max = $c }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if le $count_min -1 }}
|
||||||
|
{{ $count_min = $c }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if lt $c $count_min }}
|
||||||
|
{{ $count_min = $c }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if lt $count_min $count_min_display }}
|
||||||
|
{{ $count_min = $count_min_display }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $count_delta := sub $count_max $count_min }}
|
||||||
|
{{ $font_delta := sub $font_max $font_min }}
|
||||||
|
{{ $font_step := div $font_delta $count_delta }}
|
||||||
|
|
||||||
|
{{/* range $tags.ByCount */}}
|
||||||
|
{{ range $tags.Alphabetical }}
|
||||||
|
{{ $c := len .Pages }}
|
||||||
|
{{ if ge $c $count_min_display }}
|
||||||
|
{{ $font_size := (add $font_min (mul $c $font_step)) }}
|
||||||
|
<li style="font-size: {{ $font_size }}rem;">
|
||||||
|
<a href="/{{ .Page.Lang }}{{ .Page.Path }}">{{ .Page.LinkTitle | safeHTML }}</a><sup>{{ len .Pages }}</sup></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user