diff options
Diffstat (limited to 'assets/search-data.js')
-rw-r--r-- | assets/search-data.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/assets/search-data.js b/assets/search-data.js new file mode 100644 index 0000000..5b015e4 --- /dev/null +++ b/assets/search-data.js @@ -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); + }), + } +})(); |