27 lines
887 B
JSON
27 lines
887 B
JSON
{{- /* Verzamel alle pagina's die je wilt doorzoeken */ -}}
|
|
{{- $pages := where .Site.Pages "Type" "!=" "json" -}}
|
|
{{- $pages = where $pages "Params.ignoreSearch" "!=" true -}}
|
|
|
|
{{- /* Bouw een slice met objecten voor de search-JSON */ -}}
|
|
{{- $items := slice -}}
|
|
|
|
{{- range $e := $pages -}}
|
|
{{- $section := "" -}}
|
|
{{- with $e.Section }}{{ $section = . | humanize }}{{ end -}}
|
|
|
|
{{- $title := cond (isset $e.Params "bannertext") $e.Params.bannertext $e.Title -}}
|
|
|
|
{{- $obj := dict
|
|
"section" $section
|
|
"url" $e.Permalink
|
|
"title" $title
|
|
"description" $e.Description
|
|
"searchKeyword" $e.Params.searchKeyword
|
|
"content" $e.Plain
|
|
-}}
|
|
{{- $items = $items | append $obj -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Laat Hugo alles in één keer omzetten naar geldige JSON */ -}}
|
|
{{- $items | jsonify -}}
|