Enabling sidebar on Python-Sphinx documentation based on a sphinx-bootstrap-theme

StackOverflow https://stackoverflow.com/questions/20939598

  •  24-09-2022
  •  | 
  •  

Question

I am using the nice sphinx-bootstrap-theme 0.3.4 and trying to apply it on top of Sphinx Python Documentation Generator version 1.2.

When I build the documentation via make html, I don't get any sidebar, although it's shown to be possible in this example. Neither, I was able to find any option to enable sidebar in the build configuration file (conf.py). Doing the following:

html_sidebars = {'sidebar': ['localtoc.html', 'sourcelink.html', 'searchbox.html']}

doesn't help.

Thanks for any hint on how it's possible to enable sidebar from such a Sphinx theme.

Was it helpful?

Solution

Just figured it out. This should do the trick.

html_sidebars = {'**': ['localtoc.html', 'sourcelink.html', 'searchbox.html']}

Using this as a reference

Sphinx theming guide html_sidebars

I am experimenting with creating a custom sidebar since I don't like the included options. Using the bootstrap demo index.html I created the following for a custom sidebar. Just name it something like my_custom_sidebar.html and put it in /source/_templates

<ul class="globaltoc"
>{{ toctree(maxdepth=theme_globaltoc_depth|toint, collapse=False,includehidden=theme_globaltoc_includehidden|tobool) }}</ul>

Then edit html_sidebars

html_sidebars = {'**': ['my_custom_sidebar.html', 'searchbox.html']}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top