From fdfc144fbb2010e204bce4b062989f9748895e87 Mon Sep 17 00:00:00 2001 From: TetraTheta <37061801+TetraTheta@users.noreply.github.com> Date: Sun, 30 Jun 2024 20:03:43 +0900 Subject: [PATCH] fix(collapse): use `Scratch` instead of `now.UnixNano` to generate ID (#156) --- layouts/partials/bootstrap/collapse.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/layouts/partials/bootstrap/collapse.html b/layouts/partials/bootstrap/collapse.html index 163db36..4db4d6a 100644 --- a/layouts/partials/bootstrap/collapse.html +++ b/layouts/partials/bootstrap/collapse.html @@ -1,4 +1,8 @@ -{{- $id := printf "collapse-%d" now.UnixNano -}} +{{- if not (.Page.Scratch.Get "collapseCounter") -}} + {{- .Page.Scratch.Set "collapseCounter" 0 -}} +{{- end -}} +{{- .Page.Scratch.Add "collapseCounter" 1 -}} +{{- $id := printf "collapse-%d" (.Page.Scratch.Get "collapseCounter") -}} {{- $heading := "" -}} {{- $style := "primary" -}} {{- $expand := false -}}