selfprivacy.org/_vendor/github.com/google/docsy/assets/json/offline-search-index.json

19 lines
959 B
JSON

{{- $.Scratch.Add "offline-search-index" slice -}}
{{- range where .Site.AllPages ".Params.exclude_search" "!=" true -}}
{{- /* We have to apply `htmlUnescape` again after `truncate` because `truncate` applies `html.EscapeString` if the argument is not HTML. */ -}}
{{- /* Individual taxonomies can be added in the next line by add '"taxonomy-name" (.Params.taxonomy-name | default "")' to the dict (as seen for categories and tags). */ -}}
{{- $.Scratch.Add
"offline-search-index"
(dict
"ref" .RelPermalink
"title" .Title
"categories" (.Params.categories | default "")
"tags" (.Params.tags | default "")
"description" (.Description | default "")
"body" (.Plain | htmlUnescape)
"excerpt" ((.Description | default .Plain) | htmlUnescape | truncate (.Site.Params.offlineSearchSummaryLength | default 70) | htmlUnescape)
)
-}}
{{- end -}}
{{- $.Scratch.Get "offline-search-index" | jsonify -}}