tag cloud con font size variabile e soglia minima #247

Merged
paspo merged 3 commits from paspo/bglug.it:taglist_advanced into main 2024-09-23 20:09:40 +00:00
Showing only changes of commit 0edfafdf7b - Show all commits

View File

@ -1,4 +1,13 @@
<section>
<script>
function show_all_tags(e) {
$(".tags-sidebar li").css("display","inline-block");
$(e).css("display","none");
return false;
}
</script>
{{- $hiddenTags := slice "Linuxday-Featured" -}}
<h3>Tags</h3>
<ul class="tags-sidebar">
@ -38,11 +47,15 @@
{{/* range $tags.ByCount */}}
{{ range $tags.Alphabetical }}
{{ $c := len .Pages }}
{{ $font_size := (add $font_min (mul $c $font_step)) }}
{{ 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 }}
{{ else }}
<li style="font-size: {{ $font_size }}rem; display: none;">
<a href="/{{ .Page.Lang }}{{ .Page.Path }}">{{ .Page.LinkTitle | safeHTML }}</a><sup>{{ len .Pages }}</sup></li>
{{ end }}
{{ end }}
<li><a href="#" onclick="return show_all_tags(this)">...</a></li>
</ul>
</section>