Skip to content

Commit

Permalink
feat(icon-grid): use the page data other than site data if found (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Sep 19, 2023
1 parent 58deea3 commit 992d944
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions layouts/partials/bootstrap/functions/data.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{{- $data := false }}
{{- $siteData := site.Data }}
{{- $keys := split . "." }}
{{- range $keys }}
{{- with index $siteData . }}
{{- $siteData = . }}
{{- $data = . }}
{{- $v := false }}
{{- $key := replace .key "." "/" | printf "%s.{toml,yaml,yml,json}" }}
{{- with .page.Resources.GetMatch $key }}
{{- $v = .Content | transform.Unmarshal }}
{{- else }}
{{- $data := site.Data }}
{{- $keys := split .key "." }}
{{- range $keys }}
{{- with index $data . }}
{{- $data = . }}
{{- $v = . }}
{{- end }}
{{- end }}
{{- end }}
{{- return $data -}}
{{- return $v -}}
2 changes: 1 addition & 1 deletion layouts/partials/bootstrap/icon-grid.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{- else }}
{{- $key = .Get 0 }}
{{- end }}
{{- $data := partialCached "bootstrap/functions/data" $key $key }}
{{- $data := partialCached "bootstrap/functions/data" (dict "key" $key "page" .Page) .Page $key }}
{{- with $data }}
<div class="row g-4 row-cols-1 row-cols-md-2 row-cols-lg-3 mb-5">
{{- range sort . "weight" }}
Expand Down

0 comments on commit 992d944

Please sign in to comment.