Skip to content

Commit

Permalink
Make search work for all languages when contentDir is set. (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
frjo authored Oct 25, 2023
1 parent 8f2b5bb commit 94a6dc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion assets/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ import * as params from '@params';
}

function buildIndex() {
const searchindex = params.basePath + 'searchindex.json';
document.querySelector('.search-loading').classList.remove('hidden');
fetch('/searchindex.json')
fetch(searchindex)
.then(function (response) {
return response.json();
})
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
{{ if .HasShortcode "search" -}}
{{ $flexsearch := resources.Get "libs/flexsearch.compact.js" | fingerprint -}}
<script defer src="{{ $flexsearch.RelPermalink }}"></script>
{{ $search_opts := merge $opts (dict "params" (dict "searchLimit" (site.Params.searchLimit | default 20))) -}}
{{ $search_opts := merge $opts (dict "params" (dict "searchLimit" (site.Params.searchLimit | default 20) "basePath" site.Home.RelPermalink)) -}}
{{ $search := resources.Get "js/search.js" | js.Build $search_opts | fingerprint -}}
<script defer src="{{ $search.RelPermalink }}"></script>
{{ end -}}
Expand Down

0 comments on commit 94a6dc0

Please sign in to comment.