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
This commit is contained in:
Michael Howell 2025-07-08 09:37:04 -07:00 committed by Eric Huss
parent ec6f26e652
commit 7ec083e426

View file

@ -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 {