Hugo-theme-stack/layouts/page/search.json

20 lines
790 B
JSON
Raw Normal View History

2020-09-26 05:40:33 -04:00
{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}}
{{- $filtered := ($pages | intersect $notHidden) -}}
{{- $result := slice -}}
{{- range $filtered -}}
2020-09-26 16:50:23 -04:00
{{- $data := dict "title" .Title "date" .Date "permalink" .Permalink "content" (.Plain) -}}
2020-09-26 05:40:33 -04:00
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
{{- if and $image.exists $image.resource -}}
{{- $thumbnail := $image.resource.Fill "120x120" -}}
{{- $image := dict "image" (absURL $thumbnail.Permalink) -}}
{{- $data = merge $data $image -}}
{{ end }}
{{- $result = $result | append $data -}}
{{- end -}}
{{ jsonify $result }}