diff options
Diffstat (limited to 'themes/default/layouts/shortcodes/disclose.html')
-rw-r--r-- | themes/default/layouts/shortcodes/disclose.html | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/themes/default/layouts/shortcodes/disclose.html b/themes/default/layouts/shortcodes/disclose.html new file mode 100644 index 0000000..231561b --- /dev/null +++ b/themes/default/layouts/shortcodes/disclose.html @@ -0,0 +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 id="disclosure-{{ $hash }}" data-disclosure=""> + <summary> + {{- (or $.Page.Params.title $text) | markdownify }} + </summary> +</details> +{{- /* This comment removes trailing newlines and white spaces. */ -}} |