diff options
Diffstat (limited to 'layouts/partials/taxa.html')
-rw-r--r-- | layouts/partials/taxa.html | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/layouts/partials/taxa.html b/layouts/partials/taxa.html new file mode 100644 index 0000000..38eae3a --- /dev/null +++ b/layouts/partials/taxa.html @@ -0,0 +1,23 @@ +{{ $scratch := newScratch }} +{{ $scratch.Delete "custom" }} +{{ $flag := .showAll }} + +{{ range $name, $value := .this }} +{{ $scratch.Add "custom" (slice (dict "Name" $name "Value" $value "Num" (len $value))) }} +{{ end }} + +{{ range sort ($scratch.Get "custom") ".Num" "desc" }} +<h4> + {{ .Name | humanize }}{{if $flag }}<small class="badge">({{ .Num }})</small + >{{ end }} +</h4> +{{ $nn := cond $flag .Num 15 }} +{{ $ap := index $.this .Name }} +<div class="d-flex flex-row flex-wrap ml-2"> + {{ range first $nn $ap.ByCount }} + <div class="m-2 p-2 btn btn-dark shadow border border-light"> + <a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a><small class="badge">{{ .Count }}</small> + </div> + {{ end }} +</div> +{{ end }}
\ No newline at end of file |