sort tags by size
This commit is contained in:
parent
b01c305671
commit
e289db2fa0
@ -17,12 +17,16 @@
|
|||||||
{{ if isset .Site.Taxonomies "tags" }}
|
{{ if isset .Site.Taxonomies "tags" }}
|
||||||
{{ if not (eq (len .Site.Taxonomies.tags) 0) }}
|
{{ if not (eq (len .Site.Taxonomies.tags) 0) }}
|
||||||
<div class="tag-list">
|
<div class="tag-list">
|
||||||
|
{{ $tags := dict }}
|
||||||
{{ range $name, $items := .Site.Taxonomies.tags }}
|
{{ range $name, $items := .Site.Taxonomies.tags }}
|
||||||
{{ $pages := sort $items "Params.date" "desc" }}
|
{{ $tags = merge $tags (dict (print $name) (dict "name" $name "items" $items "len" (len $items))) }}
|
||||||
|
{{ end }}
|
||||||
|
{{ range (sort $tags "len" "desc") }}
|
||||||
|
{{ $pages := sort .items "Params.date" "desc" }}
|
||||||
{{ if or (gt (len $pages) 2) (gt ((index $pages 0).Params.date | time.AsTime).Unix (sub now.Unix 7889229)) }}
|
{{ if or (gt (len $pages) 2) (gt ((index $pages 0).Params.date | time.AsTime).Unix (sub now.Unix 7889229)) }}
|
||||||
{{ $size := "1rem" }}
|
{{ $size := "1rem" }}
|
||||||
{{ if gt (len $pages) 3 }}{{ $size = "1.25rem" }}{{ else if lt (len $pages) 2 }}{{ $size = ".75rem" }}{{ end }}
|
{{ if gt (len $pages) 3 }}{{ $size = "1.25rem" }}{{ else if lt (len $pages) 2 }}{{ $size = ".75rem" }}{{ end }}
|
||||||
<a href="{{ `tags/` | relURL }}{{ $name | urlize | lower }}" style="font-size: {{ $size }};">{{ $name }}</a>
|
<a href="{{ `tags/` | relURL }}{{ .name | urlize | lower }}" style="font-size: {{ $size }};">{{ .name }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user