hugo-book-theme/assets/search-data.js
2019-08-06 11:33:42 +02:00

24 lines
546 B
JavaScript

(function() {
const pages = [
{{ range $index, $page := .Site.Pages }}
{{- if and $index (gt $index 0) -}},{{- end }}
{
"idx": {{ $index }},
"href": "{{ $page.RelPermalink }}",
"title": "{{ partial "docs/title" $page }}",
"content": {{ $page.Plain | jsonify }}
}
{{- end -}}
];
window.bookSearch = {
pages: pages,
idx: lunr(function() {
this.ref('idx');
this.field('title');
this.field('content');
pages.forEach(this.add, this);
}),
}
})();