微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Sphinx - 如何维护页面之间的侧边栏内容?

如何解决Sphinx - 如何维护页面之间的侧边栏内容?

我有这个源目录结构:

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

这是我的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`

这是我的python.rst

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

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

   *

我的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']

执行sphinx-build -b html source build后,我得到了index.html、python.html...等

我有这个索引菜单

Index menu

我有这个 Python 菜单

enter image description here

但是,当我访问另一个像 Encapsulamiento 这样的页面时,菜单会发生变化。

enter image description here

如何修复这个显示所有帖子的幻灯片菜单栏,就像在 python.html 中一样?

解决方法

Encapsulamiento 添加到 toctree 中的 index.rst

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

    devel/python/python
    path/to/encapsulamiento

同时将 maxdepth 更改为 2

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。