Skip to content

Commit

Permalink
fix(accordion): allow using page data resources
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Feb 23, 2024
1 parent 8fe97fa commit 0b0249b
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions layouts/partials/bootstrap/accordion.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

2 comments on commit 0b0249b

@pleasantone
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be cool if the data function could also pull data from the Paige front matter params, not just a bundled file, or a site.Data?

also, the data function is used enough, maybe it should be moved into a hugomods Main? Though, I guess Hugo mods should be independent of each other mod.

@razonyang
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be cool if the data function could also pull data from the Paige front matter params

Sounds good.

also, the data function is used enough, maybe it should be moved into a hugomods Main?

Yes, maybe moved into hugomods/base.

Please sign in to comment.