aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/shortcodes/disclose.html
blob: 231561b233ac457fd94ccee34207d1ce34af93e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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. */ -}}