hugo-book-theme/assets/search-data.js

25 lines
538 B
JavaScript
Raw Normal View History

2019-07-16 14:34:02 +02:00
(function() {
const pages = [
{{ range $index, $page := .Site.Pages }}
2019-08-08 13:15:19 +02:00
{{- if $index -}},{{- end }}
2019-07-16 14:34:02 +02:00
{
"idx": {{ $index }},
"href": "{{ $page.RelPermalink }}",
2019-08-09 14:53:15 +02:00
"title": {{ (partial "docs/title" $page) | jsonify }},
2019-07-16 14:34:02 +02:00
"content": {{ $page.Plain | jsonify }}
}
{{- end -}}
];
window.bookSearch = {
pages: pages,
idx: lunr(function() {
2019-07-17 13:42:39 +02:00
this.ref("idx");
2019-08-08 13:15:19 +02:00
this.field("title");
2019-07-17 13:42:39 +02:00
this.field("content");
2019-07-16 14:34:02 +02:00
pages.forEach(this.add, this);
}),
}
})();