Files
FixIt/layouts/_partials/function/id.html
T
Cell 3e8bdfd8f9 ♻️ Refactor: global/site/page scope state management (#610)
*  Perf: adjust global/site scope state management

*  Perf: adjust page scope state management
2025-07-03 12:48:32 +08:00

13 lines
381 B
HTML

{{- /* ID */ -}}
{{- $noop := .Page.WordCount -}}
{{- $id := "" -}}
{{- with .Id -}}
{{- /* If an ID is specified, then just use it.*/ -}}
{{- $id = printf "%v" . -}}
{{- else -}}
{{- $count := ($.Page.Store.Get "this").count | default 1 -}}
{{- $id = printf "id-%d" $count -}}
{{- $count | add 1 | $.Page.Store.SetInMap "this" "count" -}}
{{- end -}}
{{- return $id -}}