aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/shortcodes/disclose.html
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/layouts/shortcodes/disclose.html')
-rw-r--r--themes/default/layouts/shortcodes/disclose.html7
1 files changed, 5 insertions, 2 deletions
diff --git a/themes/default/layouts/shortcodes/disclose.html b/themes/default/layouts/shortcodes/disclose.html
index 2cc99c7..231561b 100644
--- a/themes/default/layouts/shortcodes/disclose.html
+++ b/themes/default/layouts/shortcodes/disclose.html
@@ -1,10 +1,13 @@
{{- $text := default "Content Warning: " (.Get "text" | default (.Get 0)) -}}
+{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $text)) .Ordinal -}}
{{- if gt (len .Inner) 1 -}}
{{- $text = .Inner -}}
{{- end -}}
-<details data-disclosure>
- <summary>{{ (or $.Page.Params.title $text) | markdownify }}</summary>
+<details id="disclosure-{{ $hash }}" data-disclosure="">
+ <summary>
+ {{- (or $.Page.Params.title $text) | markdownify }}
+ </summary>
</details>
{{- /* This comment removes trailing newlines and white spaces. */ -}}