Skip to content

Commit

Permalink
search: wrong searchindex URL with multilang per server config #940
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed Oct 24, 2024
1 parent 4ed15c8 commit 4190479
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions layouts/partials/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.1+fef9c630c4745054041e7a5bcd4e7a608c224308
7.0.1+4ed15c8096764c75a97ef858bb3a4c0d784fe888

0 comments on commit 4190479

Please sign in to comment.