From 7ec083e4265672ca1e616af283c237493302c95e Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 8 Jul 2025 09:37:04 -0700 Subject: [PATCH] Work around compat break in old index.hbs templates with new searcher.js Problem reported in https://github.com/rust-lang/mdBook/pull/2742#discussion_r2190930557 --- src/front-end/searcher/searcher.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/front-end/searcher/searcher.js b/src/front-end/searcher/searcher.js index 17af071aec..18daa6e239 100644 --- a/src/front-end/searcher/searcher.js +++ b/src/front-end/searcher/searcher.js @@ -434,7 +434,10 @@ window.search = window.search || {}; function showSearch(yes) { if (yes) { - loadSearchScript(window.path_to_searchindex_js, 'search-index'); + loadSearchScript( + window.path_to_searchindex_js || + path_to_root + '{{ resource "searchindex.js" }}', + 'search-index'); search_wrap.classList.remove('hidden'); searchicon.setAttribute('aria-expanded', 'true'); } else {