karsttech.com/layouts/_default/index.json

20 lines
No EOL
854 B
JSON

{{- $index := slice -}}
{{- range .Site.Pages -}}
{{- $section := .Site.GetPage "section" .Section -}}
{{- $showDate := .Params.showDate | default .Site.Params.article.showDate -}}
{{- $summary := .Summary | emojify -}}
{{- $summary := replaceRE "<h[1-6][^>]*>(.*?)</h[1-6]>" "$1" $summary -}}
{{- $summary := replaceRE "\\s*<br\\s*/?>" " " $summary -}}
{{- $summary := replaceRE "\\s+" " " $summary -}}
{{- $summary := trim $summary " " -}}
{{- $index = $index | append (dict
"date" (cond (and .IsPage $showDate) (.Date | time.Format (site.Params.dateFormat | default ":date_long")) nil)
"title" (.Title | emojify | safeJS)
"section" ($section.Title | emojify | safeJS)
"summary" ($summary | safeJS)
"content" (.Plain | emojify | safeJS)
"permalink" .RelPermalink
)
-}}
{{- end -}}
{{- $index | jsonify -}}