hugo-theme-hilfe/assets/js/search-data.js

29 lines
683 B
JavaScript
Raw Normal View History

2020-01-12 15:33:02 +01:00
'use strict';
(function() {
const indexCfg = {{ with .Scratch.Get "geekdocSearchConfig" }}
{{ . | jsonify}};
{{ else }}
{};
{{ end }}
indexCfg.doc = {
id: 'id',
field: ['title', 'content'],
2020-11-10 22:50:21 +01:00
store: ['title', 'href', 'parent'],
2020-01-12 15:33:02 +01: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 22:50:21 +01:00
'parent': {{ with $page.Parent }}{{ (partial "title" .) | jsonify }}{{ else }}''{{ end }},
2020-01-12 15:33:02 +01:00
'content': {{ $page.Plain | jsonify }}
});
{{- end -}}
})();