aboutsummaryrefslogtreecommitdiff
path: root/static/search.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/search.js')
-rw-r--r--static/search.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/static/search.js b/static/search.js
index 6aa7019..544ca07 100644
--- a/static/search.js
+++ b/static/search.js
@@ -166,6 +166,12 @@ Source:
*/
(function(){
var lang = document.documentElement.getAttribute("lang");
+ var langOnly = lang.substring(0, 2);
+ var baseUrl = document.querySelector("meta[name='base']").getAttribute("content");
+ if (baseUrl.slice(-1) == "/") {
+ baseUrl = baseUrl.slice(0, -1);
+ }
+
var index;
searchinput.addEventListener('input', show_results, true);
suggestions.addEventListener('click', accept_suggestion, true);
@@ -173,7 +179,7 @@ Source:
async function show_results(){
var initIndex = async function () {
if (index === undefined) {
- index = fetch("/search_index." + lang + ".json")
+ index = fetch(baseUrl + '/search_index.' + langOnly + '.json')
.then(
async function(response) {
return await elasticlunr.Index.load(await response.json());