diff --git a/sphinx/builders/dirhtml.py b/sphinx/builders/dirhtml.py index 40ec7b11f..25c999003 100644 --- a/sphinx/builders/dirhtml.py +++ b/sphinx/builders/dirhtml.py @@ -9,7 +9,7 @@ """ from os import path -from typing import Any, Dict, Set +from typing import Any, Dict from sphinx.application import Sphinx from sphinx.builders.html import StandaloneHTMLBuilder @@ -45,10 +45,6 @@ class DirectoryHTMLBuilder(StandaloneHTMLBuilder): return outfilename - def prepare_writing(self, docnames: Set[str]) -> None: - super().prepare_writing(docnames) - self.globalcontext['no_search_suffix'] = True - # for compatibility deprecated_alias('sphinx.builders.html', diff --git a/sphinx/themes/basic/static/documentation_options.js_t b/sphinx/themes/basic/static/documentation_options.js_t index 66d4bab88..059e8871c 100644 --- a/sphinx/themes/basic/static/documentation_options.js_t +++ b/sphinx/themes/basic/static/documentation_options.js_t @@ -3,7 +3,8 @@ var DOCUMENTATION_OPTIONS = { VERSION: '{{ release|e }}', LANGUAGE: '{{ language }}', COLLAPSE_INDEX: false, - FILE_SUFFIX: '{{ '' if no_search_suffix else file_suffix }}', + BUILDER: '{{ builder }}', + FILE_SUFFIX: '{{ file_suffix }}', HAS_SOURCE: {{ has_source|lower }}, SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}', NAVIGATION_WITH_KEYS: {{ 'true' if theme_navigation_with_keys|tobool else 'false'}} diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js index 6031f9913..7e0174e1c 100644 --- a/sphinx/themes/basic/static/searchtools.js +++ b/sphinx/themes/basic/static/searchtools.js @@ -245,7 +245,7 @@ var Search = { if (results.length) { var item = results.pop(); var listItem = $('
'); - if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') { + if (DOCUMENTATION_OPTIONS.BUILDER === 'dirhtml') { // dirhtml builder var dirname = item[0] + '/'; if (dirname.match(/\/index\/$/)) {