diff --git a/themes/aurelia-theme/static/js/search.js b/themes/aurelia-theme/static/js/search.js index 82818ac..a497f9a 100644 --- a/themes/aurelia-theme/static/js/search.js +++ b/themes/aurelia-theme/static/js/search.js @@ -5,10 +5,17 @@ let searchPanel = null; let selectedResult = -1; let searchResultItems = []; +function getBasePath() { + // Check if we're in production by looking for /website in the path + const isProduction = window.location.pathname.includes('/website'); + return isProduction ? '/website' : ''; +} + async function fetchSearchIndex() { if (searchIndex) return searchIndex; - const response = await fetch('/index.json'); + const basePath = getBasePath(); + const response = await fetch(`${basePath}/index.json`); searchIndex = await response.json(); return searchIndex; }