InkSoul/themes/meme_cdn/layouts/index.searchindex.json

29 lines
1.5 KiB
JSON

[
{{- range $index, $page := where .Site.RegularPages "Section" "in" .Site.Params.mainSections -}}
{{- if gt $index 0 -}}
,
{{- end -}}
{{- $rawTitle := (partial "utils/title.html" (dict "$" $ "title" $page.Title)).rawTitle -}}
{{- $entry := dict "uri" $page.RelPermalink "title" $rawTitle "content" ($page.Plain | htmlUnescape) -}}
{{- if $page.Params.subtitle -}}
{{- $subtitle := partial "utils/markdownify.html" (dict "$" $page "raw" $page.Params.subtitle "isContent" false) -}}
{{- $entry = merge $entry (dict "subtitle" ($subtitle | plainify | htmlUnescape)) -}}
{{- end -}}
{{- if .Site.Params.displayPostDescription -}}
{{- $description := partial "utils/markdownify.html" (dict "$" $page "raw" $page.Description "isContent" false) -}}
{{- $entry = merge $entry (dict "description" ($description | plainify | htmlUnescape)) -}}
{{- end -}}
{{- if .Site.Params.displayCategory -}}
{{- if eq .Site.Params.categoryBy "sections" -}}
{{- $entry = merge $entry (dict "categories" (slice $page.Section)) -}}
{{- else if eq .Site.Params.categoryBy "categories" -}}
{{- $entry = merge $entry (dict "categories" $page.Params.categories) -}}
{{- end -}}
{{- end -}}
{{- if .Site.Params.enablePostTags -}}
{{- $entry = merge $entry (dict "tags" $page.Params.tags) -}}
{{- end -}}
{{- $entry | jsonify -}}
{{- end -}}
]