Sphinx - How to maintain side bar content between pages?

1k Views Asked by At

I have this source directory structure:

.
├── conf.py
├── devel
│   └── python
│       ├── Controles de flujo, condicionales y bucles.md
│       ├── Encapsulamiento.md
|       ├── (...)
├── index.rst
├── _static
├── _templates
└── webdevel

This is my index.rst:

¡Bienvenidos a Echemos un bitstazo!
======================================================

Este es mi espacio de documentación personal dónde almaceno todo tipo de conocimientos relacionados con la administración de sistemas y redes informáticas; desarrollo y otros temas varios de IT.

.. toctree::
   :maxdepth: 1 
   :caption: Administración de sistemas

   devel/python/python

Índice y tablas
==================

* :ref:`genindex`
* :ref:`search`

This is my python.rst:

Python
======================================================

.. toctree::
   :maxdepth: 1
   :caption: Contenido:
   :glob:

   *

My conf.py:

project = 'Echemos un bitstazo ~ Wiki'
copyright = '2021, Álvaro Castillo'
author = 'Álvaro Castillo'
extensions = [ 'myst_parser'
]
templates_path = ['_templates']
language = 'es'
exclude_patterns = []
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']

After do sphinx-build -b html source build, I got index.html, python.html...et

I have this index menu: Index menu

I have this Python menu: enter image description here

However, the menu is changed when I access another page likes Encapsulamiento. enter image description here

How I can fix this slide menu bar showing all posts as in python.html?

2

There are 2 best solutions below

8
Steve Piercy On BEST ANSWER

Add Encapsulamiento to your toctree in index.rst.

.. toctree::
    :maxdepth: 2
    :caption: Administración de sistemas

    devel/python/python
    path/to/encapsulamiento

Also change maxdepth to 2.

0
Noah Sprent On

@steve piercy's comment on his answer was what solved this issue for me: make clean. As he didn't want to edit his answer I'll post this here so that it doesn't get lost for other people.