Fixing Search Issue

This commit is contained in:
AidenKitamura 2022-03-22 22:11:30 +08:00
parent e70d29f5ed
commit 47fcddf092
2 changed files with 5 additions and 1 deletions

View File

@ -48,7 +48,7 @@ window.onload = function () {
} }
} }
}; };
xhr.open('GET', "../index.json"); xhr.open('GET', jsonLangUrl); // Using Relative Path to Base URL instead of to current directory
xhr.send(); xhr.send();
} }

View File

@ -21,6 +21,10 @@
</header> </header>
<div id="searchbox"> <div id="searchbox">
<!--Create Relative Link for Multilingual Search to avoid invalid URL problem-->
<script>
var jsonLangUrl = {{"/index.json" | relLangURL}};
</script>
<input id="searchInput" autofocus placeholder="{{ .Params.placeholder | default (printf "%s " .Title) }}" <input id="searchInput" autofocus placeholder="{{ .Params.placeholder | default (printf "%s " .Title) }}"
aria-label="search" type="search" autocomplete="off"> aria-label="search" type="search" autocomplete="off">
<ul id="searchResults" aria-label="search results"></ul> <ul id="searchResults" aria-label="search results"></ul>