From f480e0ab30a5eedaf009bdb8c380c685d3c45889 Mon Sep 17 00:00:00 2001 From: Tom Hummel Date: Fri, 26 Sep 2025 06:40:53 -0700 Subject: [PATCH] Display opener hash occurrence counts --- layouts/w/single.html | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/layouts/w/single.html b/layouts/w/single.html index 2a02ad78f..af8b2eba2 100644 --- a/layouts/w/single.html +++ b/layouts/w/single.html @@ -259,7 +259,23 @@

{{.Title}}

{{ else }} {{ $openerHash = partialCached "first-guess-hash" . .Title }} {{ end }} -

Opener Hash: {{ $openerHash }}

+{{ $openerHashKey := printf "%s" $openerHash }} +{{ $openerHashCount := 0 }} +{{ $openerHashOccurrence := 0 }} +{{ with (index $.Site.Taxonomies.openerhashes $openerHashKey) }} + {{ $openerHashCount = len .Pages }} + {{ range $i, $page := .Pages.ByDate }} + {{ if eq $page.RelPermalink $.RelPermalink }} + {{ $openerHashOccurrence = add $i 1 }} + {{ end }} + {{ end }} +{{ end }} +{{ $openerHashLabel := $openerHashKey }} +{{ if gt $openerHashCount 0 }} + {{ $occurrenceLabel := cond (gt $openerHashOccurrence 0) (printf "%d" $openerHashOccurrence) "?" }} + {{ $openerHashLabel = printf "%s (%s/%d)" $openerHashKey $occurrenceLabel $openerHashCount }} +{{ end }} +

Opener Hash: {{ $openerHashLabel }}

{{ with .Params.shifts }} {{ $shift := (index . 0) }}

Shift: {{ $shift }}