How to include the toctree in the sidebar of each page

I'm generating html documentation in Sphinx.

How do I modify the sidebar for each of the html pages in my document so that they include the toctree? By default the toctree only seems to display in the master_doc page, and only in the main area instead of the sidebar.

Is there an easy way to do this? I'll be using readthedocs to host the generated documentation, so I would prefer to avoid the use of any third-party plugins, unless they are also available on readthedocs.


You can customize your html sidebar in conf.py.

The default html sidebar consists of 4 templates:

['localtoc.html', 'relations.html', 'sourcelink.html', 'searchbox.html']

In conf.py you could change localtoc.html to globaltoc.html like this:

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

Since this in the end this will be used in HTML files, this should work on ReadTheDocs.


Including the 'globaltoc.html' has a drawback in that it doesn't show both the global and local toc for the page you're viewing.

It appears that others were irked about this limitation and resulted in the subsequent development of an extension to support a full toc in the sidebar, checkout: https://pypi.python.org/pypi/sphinxcontrib-fulltoc