aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2024-02-12 16:50:01 -0500
committertdro <tdro@noreply.example.com>2024-02-12 16:50:01 -0500
commitf5ff3cb4d8da23664c36911e4f16daa53890b434 (patch)
tree4b3387f2d3541eb488fe81a875bd2fd9ee2872f3
parent9ff0d7f3243eecaff0b354b392fa1e3ef4784098 (diff)
downloadcanory-f5ff3cb4d8da23664c36911e4f16daa53890b434.tar.gz
canory-f5ff3cb4d8da23664c36911e4f16daa53890b434.tar.bz2
canory-f5ff3cb4d8da23664c36911e4f16daa53890b434.zip
themes/default/layouts/shortcodes: Increase spoiler and disclose uniqueness
-rw-r--r--themes/default/layouts/shortcodes/disclose.html3
-rw-r--r--themes/default/layouts/shortcodes/spoiler.html2
2 files changed, 3 insertions, 2 deletions
diff --git a/themes/default/layouts/shortcodes/disclose.html b/themes/default/layouts/shortcodes/disclose.html
index 5422366..231561b 100644
--- a/themes/default/layouts/shortcodes/disclose.html
+++ b/themes/default/layouts/shortcodes/disclose.html
@@ -1,10 +1,11 @@
{{- $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="">
+<details id="disclosure-{{ $hash }}" data-disclosure="">
<summary>
{{- (or $.Page.Params.title $text) | markdownify }}
</summary>
diff --git a/themes/default/layouts/shortcodes/spoiler.html b/themes/default/layouts/shortcodes/spoiler.html
index 5a9462d..9c5e59a 100644
--- a/themes/default/layouts/shortcodes/spoiler.html
+++ b/themes/default/layouts/shortcodes/spoiler.html
@@ -1,6 +1,6 @@
{{- $text := default "This is a spoiler." (.Get "text" | default (.Get 0)) -}}
{{- $title := default "Click to show/hide text." (.Get "title" | default (.Get 1)) -}}
-{{- $hash := print (truncate 8 "" (sha256 $text)) .Ordinal -}}
+{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $text)) .Ordinal -}}
{{- if gt (len .Inner) 1 -}}
{{- $text = .Inner -}}