2020-09-26 09:40:33 +00:00
|
|
|
{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
|
|
|
|
{{- $result := slice -}}
|
|
|
|
|
2022-10-29 15:02:24 +00:00
|
|
|
{{- range $pages -}}
|
2020-09-26 20:50:23 +00:00
|
|
|
{{- $data := dict "title" .Title "date" .Date "permalink" .Permalink "content" (.Plain) -}}
|
2020-09-26 09:40:33 +00:00
|
|
|
|
|
|
|
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
|
2020-12-25 08:39:04 +00:00
|
|
|
{{- if $image.exists -}}
|
|
|
|
{{- $imagePermalink := "" -}}
|
2022-10-29 15:02:24 +00:00
|
|
|
{{- if and $image.resource .Page.Site.Params.imageProcessing.cover.enabled -}}
|
2020-12-23 20:02:35 +00:00
|
|
|
{{- $thumbnail := $image.resource.Fill "120x120" -}}
|
2020-12-25 08:39:04 +00:00
|
|
|
{{- $imagePermalink = (absURL $thumbnail.Permalink) -}}
|
2020-12-23 20:02:35 +00:00
|
|
|
{{- else -}}
|
2020-12-25 08:39:04 +00:00
|
|
|
{{- $imagePermalink = $image.permalink -}}
|
2020-12-23 20:02:35 +00:00
|
|
|
{{- end -}}
|
2020-12-25 08:39:04 +00:00
|
|
|
|
|
|
|
{{- $data = merge $data (dict "image" (absURL $imagePermalink)) -}}
|
|
|
|
{{- end -}}
|
2020-09-26 09:40:33 +00:00
|
|
|
|
|
|
|
{{- $result = $result | append $data -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{ jsonify $result }}
|