【问题标题】:Sphinx - How to maintain side bar content between pages?Sphinx - 如何维护页面之间的侧边栏内容?
【发布时间】:2021-08-31 01:23:31
【问题描述】:

我有这个源目录结构:

.
├── 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...等

我有这个索引菜单:

我有这个 Python 菜单:

但是,当我访问另一个页面(如 Encapsulamiento)时,菜单会发生变化。

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

【问题讨论】:

    标签: markdown python-sphinx restructuredtext read-the-docs toctree


    【解决方案1】:

    Encapsulamiento 添加到index.rst 中的toctree

    .. toctree::
        :maxdepth: 2
        :caption: Administración de sistemas
    
        devel/python/python
        path/to/encapsulamiento
    

    还将maxdepth 更改为2

    【讨论】:

    • 嗨!感谢您的回答,但它只是添加到 index.html 菜单项。 i.imgur.com/HzLw78M.png封装--> i.imgur.com/Os2SZ02.png
    • 也许将maxdepth 更改为2
    • Noup,因为如果我设置 maxdepth,我在 index.html 中得到了 python.rst 的索引:/ 并且它没有解决它。
    • 您是否先执行make clean,然后强制重新加载页面?您可能正在浏览器或构建目录中查看缓存文件。 Sphinx 仅重建已更改的页面,如果唯一更改是在 index.rst 中,那将是唯一更新的页面。
    • @sincorchetes 请您接受我的答案作为解决方案,通过检查并选择支持它吗?
    猜你喜欢
    • 2012-07-24
    • 2019-11-29
    • 2021-05-29
    • 1970-01-01
    • 2018-07-17
    • 1970-01-01
    • 2015-10-24
    • 2021-12-01
    • 1970-01-01
    相关资源
    最近更新 更多