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

github.com/dillonzq/LoveIt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/function/id.html')
-rw-r--r--layouts/partials/function/id.html10
1 files changed, 4 insertions, 6 deletions
diff --git a/layouts/partials/function/id.html b/layouts/partials/function/id.html
index 4adeb70b..cff12fcc 100644
--- a/layouts/partials/function/id.html
+++ b/layouts/partials/function/id.html
@@ -1,8 +1,6 @@
{{- /* ID */ -}}
-{{- /* Content -> unique ID */ -}}
-{{- /* shuffle md5 as id */ -}}
-{{- $id := delimit (split (md5 now.Unix) "" | shuffle | first 6) "" | printf "id-%s" -}}
-{{- with .scratch -}}
- {{- dict $id $.content | dict "data" | dict "config" | merge (.Get "this") | .Set "this" -}}
-{{- end -}}
+{{- $count := (.scratch.Get "this").count | default 1 -}}
+{{- $id := printf "id-%d" $count -}}
+{{- $count | add 1 | .scratch.SetInMap "this" "count" -}}
+{{- dict $id .content | dict "data" | dict "config" | merge (.scratch.Get "this") | .scratch.Set "this" -}}
{{- return $id -}}