uci-doc/assets/js/search-data.js

29 lines
683 B
JavaScript
Raw Normal View History

2020-01-12 06:33:02 -08:00
'use strict';
(function() {
const indexCfg = {{ with .Scratch.Get "geekdocSearchConfig" }}
{{ . | jsonify}};
{{ else }}
{};
{{ end }}
indexCfg.doc = {
id: 'id',
field: ['title', 'content'],
2020-11-10 13:50:21 -08:00
store: ['title', 'href', 'parent'],
2020-01-12 06:33:02 -08:00
};
const index = FlexSearch.create(indexCfg);
window.geekdocSearchIndex = index;
{{ range $index, $page := .Site.Pages }}
index.add({
'id': {{ $index }},
'href': '{{ $page.RelPermalink }}',
'title': {{ (partial "title" $page) | jsonify }},
2020-11-10 13:50:21 -08:00
'parent': {{ with $page.Parent }}{{ (partial "title" .) | jsonify }}{{ else }}''{{ end }},
2020-01-12 06:33:02 -08:00
'content': {{ $page.Plain | jsonify }}
});
{{- end -}}
})();