Search: Use relative URLs within generated configuration and data files
Always use relative URLs when generating the configuration and data file for the search bar. This fixes issues with deployments that run under a sub-path, e.g. https://example.com/path.
This commit is contained in:
parent
5888203d0d
commit
3f7aab769e
|
@ -1,7 +1,7 @@
|
|||
{{- $searchDataFile := printf "search/%s.data.json" .Language.Lang -}}
|
||||
{{- $searchData := resources.Get "search/data.json" | resources.ExecuteAsTemplate $searchDataFile . | resources.Minify -}}
|
||||
{
|
||||
"dataFile": {{ $searchData.RelPermalink | jsonify }},
|
||||
"dataFile": {{ printf ".%s" $searchData.RelPermalink | jsonify }},
|
||||
"indexConfig": {{ .Site.Params.geekdocSearchConfig | jsonify }},
|
||||
"showParent": {{ if .Site.Params.geekdocSearchShowParent }}true{{ else }}false{{ end }},
|
||||
"showDescription": {{ if .Site.Params.geekdocSearchshowDescription }}true{{ else }}false{{ end }}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{{ if ne $index 0 }},{{ end }}
|
||||
{
|
||||
"id": {{ $index }},
|
||||
"href": "{{ $page.RelPermalink }}",
|
||||
"href": ".{{ $page.RelPermalink }}",
|
||||
"title": {{ (partial "utils/title" $page) | jsonify }},
|
||||
"parent": {{ with $page.Parent }}{{ (partial "utils/title" .) | jsonify }}{{ else }}""{{ end }},
|
||||
"content": {{ $page.Plain | jsonify }},
|
||||
|
|
Loading…
Reference in New Issue