mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2024-11-25 12:46:44 +00:00
25 lines
538 B
JavaScript
25 lines
538 B
JavaScript
(function() {
|
|
const pages = [
|
|
{{ range $index, $page := .Site.Pages }}
|
|
{{- if $index -}},{{- end }}
|
|
{
|
|
"idx": {{ $index }},
|
|
"href": "{{ $page.RelPermalink }}",
|
|
"title": {{ (partial "docs/title" $page) | jsonify }},
|
|
"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);
|
|
}),
|
|
}
|
|
})();
|