aboutsummaryrefslogtreecommitdiff
path: root/assets/search-data.js
blob: 5b015e4531fc710012b0c1a5598a860561bd5d52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
    }),
  }
})();