hugo-theme-relearn/layouts/partials/make-random-md5.hugo

13 lines
387 B
Text
Raw Normal View History

2023-05-17 20:55:34 +00:00
{{- $context := . }}
{{- if (ne $context.Site.Params.disableRandomIds true) }}
{{- $random := "" }}
{{- $set := split "012345abcdefghijklmnopqrstuvwxyz" "" }}
{{- range (seq 16) }}
{{- with ($set | shuffle | first 1) }}
{{- $random = printf "%s%s" $random . }}
{{- end }}
{{- end }}
2023-05-17 20:55:34 +00:00
{{- md5 $random }}
{{- else }}
{{- printf "00000000000000000000000000000000" }}
{{- end }}