search: wrong searchindex URL with multilang per server config #940

This commit is contained in:
Sören Weber 2024-10-24 16:28:23 +02:00
parent 4ed15c8096
commit 4190479458
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 4 additions and 3 deletions

View file

@ -11,14 +11,15 @@
{{- warnf "UNSUPPORTED usage of 'searchpage' output format found, remove it from your config; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
{{- end }}
{{- if not .Site.Params.disableSearchIndex }}
{{- $url := path.Join .Site.LanguagePrefix (trim (or .Site.Params.searchIndexURL "searchindex.js") "/") }}
{{- $url := trim (or .Site.Params.searchIndexURL "searchindex.js") "/" }}
{{- $url = path.Join (path.Dir $url) (print (path.BaseName $url) "." .Language.Lang (path.Ext $url)) }}
{{- if .IsHome }}
{{- $templateres := resources.Get "_relearn_searchindex.js" }}
{{- $resultres := $templateres | resources.ExecuteAsTemplate $url .Site.Home }}
{{- /* the following code causes Hugo to generate our file - although it is in comments */}}<!-- {{ $resultres.RelPermalink }} -->
{{- end }}
<script>
window.index_js_url={{ (printf "%s%s" $url $assetBusting) | relLangURL }};
window.index_js_url={{ (printf "%s%s" $url $assetBusting) | relURL }};
</script>
{{- if not .Site.Params.disableSearchPage }}
{{- with .Site.GetPage "_relearn_searchpage" }}

View file

@ -1 +1 @@
7.0.1+fef9c630c4745054041e7a5bcd4e7a608c224308
7.0.1+4ed15c8096764c75a97ef858bb3a4c0d784fe888