diff --git a/layouts/partials/bootstrap/accordion.html b/layouts/partials/bootstrap/accordion.html new file mode 100644 index 0000000..599e3cc --- /dev/null +++ b/layouts/partials/bootstrap/accordion.html @@ -0,0 +1,60 @@ +{{- $data := "" }} +{{- $flush := false }} +{{- $alwaysOpen := false }} +{{- if .IsNamedParams }} + {{- $data = .Get "data" }} + {{- if isset .Params "flush" }}{{ $flush = .Get "flush" }}{{ end }} + {{- if isset .Params "alwaysOpen" }} + {{- $alwaysOpen = .Get "alwaysOpen" }} + {{- end }} +{{- else }} + {{- $data = .Get 0 }} +{{- end }} +{{- $items := slice }} +{{- $items := site.Data }} +{{- range split $data "." }} + {{- with index $items . }} + {{- $items = . }} + {{- else }} + {{- $items = false }} + {{- break }} + {{- end }} +{{- end }} +{{- if not $data }} + {{- warnf `[bootstrap][accordion] the data name is required.` }} +{{- else if eq $items false }} + {{- warnf `[bootstrap][accordion] the data file is missing: %s.` $data }} +{{- else }} + {{- $id := printf "accordion-%d-%s" .Ordinal $data }} +