mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-27 04:03:48 +01:00
b03390d237
Revert "Merge branch 'canary' into master (#711)"
This reverts commit 8a597a5c9c
.
26 lines
No EOL
1 KiB
JSON
26 lines
No EOL
1 KiB
JSON
{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
|
|
{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}}
|
|
{{- $filtered := ($pages | intersect $notHidden) -}}
|
|
|
|
{{- $result := slice -}}
|
|
|
|
{{- range $filtered -}}
|
|
{{- $data := dict "title" .Title "date" .Date "permalink" .Permalink "content" (.Plain) -}}
|
|
|
|
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
|
|
{{- if $image.exists -}}
|
|
{{- $imagePermalink := "" -}}
|
|
{{- if and $image.resource (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
|
|
{{- $thumbnail := $image.resource.Fill "120x120" -}}
|
|
{{- $imagePermalink = (absURL $thumbnail.Permalink) -}}
|
|
{{- else -}}
|
|
{{- $imagePermalink = $image.permalink -}}
|
|
{{- end -}}
|
|
|
|
{{- $data = merge $data (dict "image" (absURL $imagePermalink)) -}}
|
|
{{- end -}}
|
|
|
|
{{- $result = $result | append $data -}}
|
|
{{- end -}}
|
|
|
|
{{ jsonify $result }} |