在 Sphinx ReadTheDocs 主题中禁用顶部导航栏(面包屑)
Disabling the top navigation bar (breadcrumbs) in Sphinx ReadTheDocs theme
我想禁用 ReadTheDocs 主题的顶部导航栏。对于其他主题,例如classic
它只是一个选项
html_theme = "classic"
html_theme_options = {
"showrelbartop": False
}
如何修改阅读文档主题以禁用此顶部导航栏?
编辑:
使用 make html
处理源文件后,我必须删除 html 个文件中的这些行
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li></li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
获得预期的结果。在使用 make html
?
编译源代码之前是否有可能获得此结果?
我假设您指的是面包屑 (breadcrumbs.html
)。您只需打开主模板文件 - layout.html
- 并删除或注释掉以下行:
{% include "breadcrumbs.html" %}
一个老问题,但我也需要这个。一个比当前接受的答案更简单的答案,它适用于 Sphinx==3.5.3 和 sphinx-rtd-theme==0.5.2 是:
- 在
docs/_templates/
中创建一个名为 breadcrumbs.html
的文件
- 在该文件中,写一个 html 注释,例如
<!-- Empty override file take the place of env/lib/python3.8/site-packages/sphinx_rtd_theme/breadcrumbs.html, which generates the top nav breadcrumbs. -->
。
重建,大功告成。
我想禁用 ReadTheDocs 主题的顶部导航栏。对于其他主题,例如classic
它只是一个选项
html_theme = "classic"
html_theme_options = {
"showrelbartop": False
}
如何修改阅读文档主题以禁用此顶部导航栏?
编辑:
使用 make html
处理源文件后,我必须删除 html 个文件中的这些行
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li></li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
获得预期的结果。在使用 make html
?
我假设您指的是面包屑 (breadcrumbs.html
)。您只需打开主模板文件 - layout.html
- 并删除或注释掉以下行:
{% include "breadcrumbs.html" %}
一个老问题,但我也需要这个。一个比当前接受的答案更简单的答案,它适用于 Sphinx==3.5.3 和 sphinx-rtd-theme==0.5.2 是:
- 在
docs/_templates/
中创建一个名为breadcrumbs.html
的文件
- 在该文件中,写一个 html 注释,例如
<!-- Empty override file take the place of env/lib/python3.8/site-packages/sphinx_rtd_theme/breadcrumbs.html, which generates the top nav breadcrumbs. -->
。
重建,大功告成。