diff options
-rw-r--r-- | themes/default/layouts/shortcodes/disclose.html | 3 | ||||
-rw-r--r-- | themes/default/layouts/shortcodes/spoiler.html | 2 |
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 -}} |