Allow geekdocSearchShowParent
This commit is contained in:
parent
92254349c4
commit
c2895e5c2a
3 changed files with 17 additions and 1 deletions
|
@ -10,7 +10,7 @@
|
|||
indexCfg.doc = {
|
||||
id: 'id',
|
||||
field: ['title', 'content'],
|
||||
store: ['title', 'href'],
|
||||
store: ['title', 'href', 'parent'],
|
||||
};
|
||||
|
||||
const index = FlexSearch.create(indexCfg);
|
||||
|
@ -21,6 +21,7 @@
|
|||
'id': {{ $index }},
|
||||
'href': '{{ $page.RelPermalink }}',
|
||||
'title': {{ (partial "title" $page) | jsonify }},
|
||||
'parent': {{ with $page.Parent }}{{ (partial "title" .) | jsonify }}{{ else }}''{{ end }},
|
||||
'content': {{ $page.Plain | jsonify }}
|
||||
});
|
||||
{{- end -}}
|
||||
|
|
|
@ -46,7 +46,12 @@
|
|||
a = li.appendChild(document.createElement('a'));
|
||||
|
||||
a.href = page.href;
|
||||
|
||||
{{ if .Site.Params.GeekdocSearchShowParent }}
|
||||
a.textContent = page.parent ? page.parent + ' / ' + page.title : page.title;
|
||||
{{ else }}
|
||||
a.textContent = page.title;
|
||||
{{ end }}
|
||||
|
||||
results.appendChild(li);
|
||||
results.classList.add("DUMMY");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue