Reputation: 1385
Is there a simple way (i.e., without creating an entirely new theme) to customize Sphinx so that it generates HTML pages without the search box?
Upvotes: 13
Views: 3877
Reputation: 1385
An alternative, which I discovered reading the alabaster theme documentation is to explicitly list which (if any sidebars) are desired in the conf.py
file. For example, including this fragment in conf.py
:
html_theme = 'alabaster'
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'searchbox.html',
]
}
produces the searchbox; removing searchbox.html
from that list and then building produces the same page but without the box. (More information can be found at the Sphinx documentation for the build-configuration file.)
Upvotes: 17
Reputation: 51002
You can do it by customizing (or should I say disabling) the searchbox template.
In conf.py, add this line:
templates_path = ["templates"]
Create a folder called templates
in your Sphinx project directory.
In that folder, add an empty file called searchbox.html. This overrides the default template file (located in sphinx/themes/basic
where Sphinx is installed).
Upvotes: 14