Search code examples
documentationpython-sphinx

Left panel in the sphinx documentation is collapsing every time I click on something


I am working on Sphnix documentation :

for my project index.rst looks like :

Table of Contents
--------------------------------------

.. toctree::
   :maxdepth: 2
   :titlesonly:

   sphnix_toolbox.testing
   ...

here sphnix_toolbox.testing is the rst files.

Now sphnix_toolbox.testing.rst looks like:

Source
----------

.. toctree::
   :maxdepth: 2

   Sphnix
   run_setup
   ...

These are also rst files.

Just for the example I am showing this image: enter image description here

So my problem is when I am clicking anything on the left panel for e.g check_asset_copy. left panel was colapsing to the default. Like this

enter image description here

I want it to collapse only when I click on something outside sphnix_toolbox.testing or anything else. It was collapsing everytime I click on anything from the left panel.

Currenlty using html_theme = "sphinx_rtd_theme".


Solution

  • Refer to this link :

    https://sphinx-rtd-theme.readthedocs.io/en/stable/configuring.html

    use toc options.

    'collapse_navigation': True,
    'sticky_navigation': True,
    

    Sticky will maintain the context in the Left panel.