summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--themes/danix-xyz-hacker/assets/js/search.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/themes/danix-xyz-hacker/assets/js/search.js b/themes/danix-xyz-hacker/assets/js/search.js
index 94c6323..8fb6262 100644
--- a/themes/danix-xyz-hacker/assets/js/search.js
+++ b/themes/danix-xyz-hacker/assets/js/search.js
@@ -1,10 +1,14 @@
-// Lazy-load search index from JSON file
+// Lazy-load search index from JSON file (language-aware)
async function loadSearchIndex() {
if (window.searchIndex) {
return window.searchIndex;
}
try {
- const response = await fetch('/search-index.json');
+ // Detect current language from URL
+ const isItalian = window.location.pathname.startsWith('/it/');
+ const indexPath = isItalian ? '/it/search-index.json' : '/search-index.json';
+
+ const response = await fetch(indexPath);
if (!response.ok) throw new Error('Failed to load search index');
window.searchIndex = await response.json();
return window.searchIndex;