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 = {
|
indexCfg.doc = {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
field: ['title', 'content'],
|
field: ['title', 'content'],
|
||||||
store: ['title', 'href'],
|
store: ['title', 'href', 'parent'],
|
||||||
};
|
};
|
||||||
|
|
||||||
const index = FlexSearch.create(indexCfg);
|
const index = FlexSearch.create(indexCfg);
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
'id': {{ $index }},
|
'id': {{ $index }},
|
||||||
'href': '{{ $page.RelPermalink }}',
|
'href': '{{ $page.RelPermalink }}',
|
||||||
'title': {{ (partial "title" $page) | jsonify }},
|
'title': {{ (partial "title" $page) | jsonify }},
|
||||||
|
'parent': {{ with $page.Parent }}{{ (partial "title" .) | jsonify }}{{ else }}''{{ end }},
|
||||||
'content': {{ $page.Plain | jsonify }}
|
'content': {{ $page.Plain | jsonify }}
|
||||||
});
|
});
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
|
@ -46,7 +46,12 @@
|
||||||
a = li.appendChild(document.createElement('a'));
|
a = li.appendChild(document.createElement('a'));
|
||||||
|
|
||||||
a.href = page.href;
|
a.href = page.href;
|
||||||
|
|
||||||
|
{{ if .Site.Params.GeekdocSearchShowParent }}
|
||||||
|
a.textContent = page.parent ? page.parent + ' / ' + page.title : page.title;
|
||||||
|
{{ else }}
|
||||||
a.textContent = page.title;
|
a.textContent = page.title;
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
results.appendChild(li);
|
results.appendChild(li);
|
||||||
results.classList.add("DUMMY");
|
results.classList.add("DUMMY");
|
||||||
|
|
|
@ -62,6 +62,11 @@ enableGitInfo = true
|
||||||
# Index is built on the fly and might slowdown your website.
|
# Index is built on the fly and might slowdown your website.
|
||||||
geekdocSearch = false
|
geekdocSearch = false
|
||||||
|
|
||||||
|
# (Optional, default false) Display search results with the parent folder as prefix. This
|
||||||
|
# option allows you to distinguish between files with the same name in different folders.
|
||||||
|
# NOTE: This parameter only applies when geekdocSearch=true
|
||||||
|
GeekdocSearchShowParent = true
|
||||||
|
|
||||||
# (Optional, default none) Add a link to your Legal Notice page to the site footer.
|
# (Optional, default none) Add a link to your Legal Notice page to the site footer.
|
||||||
# It can be either a remote url or a local file path relative to your content directory.
|
# It can be either a remote url or a local file path relative to your content directory.
|
||||||
geekdocLegalNotice = "https://blog.example.com/legal"
|
geekdocLegalNotice = "https://blog.example.com/legal"
|
||||||
|
@ -137,6 +142,11 @@ params:
|
||||||
# Index is built on the fly and might slowdown your website.
|
# Index is built on the fly and might slowdown your website.
|
||||||
geekdocSearch: false
|
geekdocSearch: false
|
||||||
|
|
||||||
|
# (Optional, default false) Display search results with the parent folder as prefix. This
|
||||||
|
# option allows you to distinguish between files with the same name in different folders.
|
||||||
|
# NOTE: This parameter only applies when geekdocSearch=true
|
||||||
|
GeekdocSearchShowParent: true
|
||||||
|
|
||||||
# (Optional, default none) Add a link to your Legal Notice page to the site footer.
|
# (Optional, default none) Add a link to your Legal Notice page to the site footer.
|
||||||
# It can be either a remote url or a local file path relative to your content directory.
|
# It can be either a remote url or a local file path relative to your content directory.
|
||||||
geekdocLegalNotice: "https://blog.example.com/legal"
|
geekdocLegalNotice: "https://blog.example.com/legal"
|
||||||
|
|
Loading…
Reference in a new issue