Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 495
mannaia Avatar asked Jan 05 '14 21:01

mannaia


1 Answers

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']}
like image 159
fred Avatar answered Oct 19 '22 17:10

fred