Implement search, loading on demand

This commit is contained in:
Alex Shpak
2019-07-16 14:34:02 +02:00
parent dda0a0eab1
commit 1f3addcca5
16 changed files with 119 additions and 69 deletions
+24
View File
@@ -0,0 +1,24 @@
(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);
}),
}
})();