vanilla-hugo/layouts/shortcodes/internal.html
Danila Fedorin 431d4b0990 Add new internal ref shortcodes
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-12-25 19:03:05 -08:00

13 lines
430 B
HTML

{{- $name := .Get 0 -}}
{{- $number := 1 -}}
{{- with .Page.Scratch.Get "internal-ref-counter" -}}
{{- $number = add . 1 }}
{{- end -}}
{{- .Page.Scratch.Set "internal-ref-counter" $number -}}
{{- .Page.Scratch.SetInMap "internal-ref" $name $number -}}
<span class="internal-ref" id="internal-ref-{{ $name }}">
{{ .Inner }}
<span class="internal-ref-counter">{{ $number }}</span></span>
{{- /* chomp whitespace at the end */ -}}