diff --git a/layouts/shortcodes/accordion.html b/layouts/shortcodes/accordion.html new file mode 100644 index 00000000..cf20c79a --- /dev/null +++ b/layouts/shortcodes/accordion.html @@ -0,0 +1,6 @@ +{{ $id := delimit (slice "accordion" (partial "functions/uid.html" .)) "-" }} +{{ $mode := .Get "mode" | default "collapse" }} + +
+ {{- .Inner -}} +
diff --git a/layouts/shortcodes/accordionItem.html b/layouts/shortcodes/accordionItem.html new file mode 100644 index 00000000..f4ebbbc9 --- /dev/null +++ b/layouts/shortcodes/accordionItem.html @@ -0,0 +1,37 @@ +{{ $parent := .Parent }} +{{ $groupID := "" }} +{{ $mode := "collapse" }} +{{ if $parent }} + {{ $groupID = delimit (slice "accordion" (partial "functions/uid.html" $parent)) "-" }} + {{ $mode = $parent.Get "mode" | default "collapse" }} +{{ else }} + {{ $groupID = delimit (slice "accordion" (partial "functions/uid.html" .)) "-" }} +{{ end }} + +{{ $id := delimit (slice "accordion-item" (partial "functions/uid.html" .)) "-" }} +{{ $title := .Get "title" | default (.Get "header") }} +{{ $open := .Get "open" | default false }} +{{ $isOpen := or (eq $open true) (eq $open "true") }} + +
+ + +
+
+ {{- .Inner | markdownify -}} +
+
+