From 737b696e01f05874b49f7f1c4b9b87793bf81870 Mon Sep 17 00:00:00 2001 From: Natanael Rodriguez Ramos Date: Sat, 25 Jul 2026 17:42:01 +0100 Subject: [PATCH 1/2] bugfix: knowledge search --- src/themes/ivpn-v3/assets/js/search.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/themes/ivpn-v3/assets/js/search.js b/src/themes/ivpn-v3/assets/js/search.js index 46449ad78..ecb37a540 100644 --- a/src/themes/ivpn-v3/assets/js/search.js +++ b/src/themes/ivpn-v3/assets/js/search.js @@ -24,11 +24,24 @@ const app = createApp({ } }, fetchAndSearch(query) { - fetch('/en/pages/index.json') - .then(response => response.json()) + // Derive locale from the current URL path (/en/..., /es/..., etc.) + // so the correct per-locale index is fetched. Fall back to 'en'. + const locale = window.location.pathname.split('/').filter(Boolean)[0] || 'en'; + fetch(`/${locale}/pages/index.json`) + .then(response => { + if (!response.ok) { + // Try the English index as a fallback + return fetch('/en/pages/index.json').then(r => r.json()); + } + return response.json(); + }) .then(data => { this.collection = data this.search(data, query) + }) + .catch(() => { + this.renderTitle([], query) + this.renderList([]) }); }, search(data, query) { From caa75e4dfbfd59a8d5be6ff402d5d4ef493fc345 Mon Sep 17 00:00:00 2001 From: Natanael Rodriguez Ramos Date: Sat, 25 Jul 2026 17:59:51 +0100 Subject: [PATCH 2/2] bugfix: knowledge search --- src/config/_default/config.toml | 1 + src/themes/ivpn-v3/assets/js/search.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config/_default/config.toml b/src/config/_default/config.toml index 2696a536d..09f10076f 100644 --- a/src/config/_default/config.toml +++ b/src/config/_default/config.toml @@ -22,6 +22,7 @@ defaultContentLanguageInSubdir = true weight = 1 [languages.en.outputs] home = ["HTML", "LLMS"] + section = ["JSON", "HTML", "RSS"] [languages.es] languageCode = "es" contentDir = 'content/es' diff --git a/src/themes/ivpn-v3/assets/js/search.js b/src/themes/ivpn-v3/assets/js/search.js index ecb37a540..414806480 100644 --- a/src/themes/ivpn-v3/assets/js/search.js +++ b/src/themes/ivpn-v3/assets/js/search.js @@ -26,7 +26,9 @@ const app = createApp({ fetchAndSearch(query) { // Derive locale from the current URL path (/en/..., /es/..., etc.) // so the correct per-locale index is fetched. Fall back to 'en'. - const locale = window.location.pathname.split('/').filter(Boolean)[0] || 'en'; + const knownLocales = ['en', 'es']; + const firstSegment = window.location.pathname.split('/').filter(Boolean)[0] || ''; + const locale = knownLocales.includes(firstSegment) ? firstSegment : 'en'; fetch(`/${locale}/pages/index.json`) .then(response => { if (!response.ok) {