From 0b0249b0b164d536be7e9b094f873ebc95e6dce0 Mon Sep 17 00:00:00 2001 From: razonyang Date: Fri, 23 Feb 2024 23:38:45 +0800 Subject: [PATCH] fix(accordion): allow using page data resources --- layouts/partials/bootstrap/accordion.html | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/layouts/partials/bootstrap/accordion.html b/layouts/partials/bootstrap/accordion.html index 67d2d36..03a268f 100644 --- a/layouts/partials/bootstrap/accordion.html +++ b/layouts/partials/bootstrap/accordion.html @@ -10,17 +10,8 @@ {{- 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 }} +{{- $items := partial "bootstrap/functions/data" (dict "key" $data "page" .Page) }} +{{- if not $items }} {{- warnf `[bootstrap][accordion] the data name is required.` }} {{- else if eq $items false }} {{- warnf `[bootstrap][accordion] the data file is missing: %s.` $data }}