2020-09-26 05:40:33 -04:00
|
|
|
{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
|
2022-10-29 11:14:19 -04:00
|
|
|
{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}}
|
|
|
|
{{- $filtered := ($pages | intersect $notHidden) -}}
|
|
|
|
|
2020-09-26 05:40:33 -04:00
|
|
|
{{- $result := slice -}}
|
|
|
|
|
2022-10-29 11:14:19 -04:00
|
|
|
{{- 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" -}}
|
2020-12-25 03:39:04 -05:00
|
|
|
{{- if $image.exists -}}
|
|
|
|
{{- $imagePermalink := "" -}}
|
2022-10-29 11:14:19 -04:00
|
|
|
{{- if and $image.resource (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
|
2020-12-23 15:02:35 -05:00
|
|
|
{{- $thumbnail := $image.resource.Fill "120x120" -}}
|
2020-12-25 03:39:04 -05:00
|
|
|
{{- $imagePermalink = (absURL $thumbnail.Permalink) -}}
|
2020-12-23 15:02:35 -05:00
|
|
|
{{- else -}}
|
2020-12-25 03:39:04 -05:00
|
|
|
{{- $imagePermalink = $image.permalink -}}
|
2020-12-23 15:02:35 -05:00
|
|
|
{{- end -}}
|
2020-12-25 03:39:04 -05:00
|
|
|
|
|
|
|
{{- $data = merge $data (dict "image" (absURL $imagePermalink)) -}}
|
|
|
|
{{- end -}}
|
2020-09-26 05:40:33 -04:00
|
|
|
|
|
|
|
{{- $result = $result | append $data -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{ jsonify $result }}
|