hextra/assets/json/search-data.json

20 lines
633 B
JSON
Raw Normal View History

2023-08-04 01:11:31 +01:00
{{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
{{- $pages = where $pages "Params.excludeSearch" "!=" true -}}
{{- $pages = where $pages "Content" "!=" "" -}}
[
{{ range $index, $page := $pages }}
{{ $pageTitle := $page.LinkTitle | default $page.File.BaseFileName }}
{{ $pageContent := $page.Plain }}
{{ $pageSection := $page.Parent.LinkTitle }}
{{ if gt $index 0}},{{end}} {
"id": {{ $index }},
"href": "{{ $page.Permalink }}",
"title": {{ $pageTitle | jsonify }},
"section": {{ $pageSection | jsonify }},
"content": {{ $page.Plain | jsonify }}
}
{{- end -}}
]