Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/darshanbaral/khata.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/taxa.html')
-rw-r--r--layouts/partials/taxa.html25
1 files changed, 25 insertions, 0 deletions
diff --git a/layouts/partials/taxa.html b/layouts/partials/taxa.html
new file mode 100644
index 0000000..83cf655
--- /dev/null
+++ b/layouts/partials/taxa.html
@@ -0,0 +1,25 @@
+{{ $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" }}
+{{ $taxaTypeName := .Name }}
+ <h2>
+ {{ $taxaTypeName | humanize }}{{if $flag }}<small class="badge" title="Number of unique {{ $taxaTypeName | humanize }}">({{ .Num }})</small
+ >{{ end }}
+ </h2>
+ {{ $n_taxa := cond $flag .Num 5 }}
+ {{ $this_taxa := index $.this .Name }}
+ <div class="d-flex flex-row flex-wrap ml-2 mb-4">
+ {{ range first $n_taxa $this_taxa.ByCount }}
+ <div class="m-1 p-1 btn btn-light border border-secondary">
+ <a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a
+ > - <small title="Number of articles with {{ $taxaTypeName | singularize | humanize }} '{{ .Page.Title }}'">{{ .Count }}</small>
+ </div>
+ {{ end }}
+ </div>
+{{ end }}