【问题标题】:Disabling the top navigation bar (breadcrumbs) in Sphinx ReadTheDocs theme在 Sphinx ReadTheDocs 主题中禁用顶部导航栏(面包屑)
【发布时间】:2016-02-13 16:58:40
【问题描述】:

我想禁用 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> &raquo;</li>
    <li></li>
      <li class="wy-breadcrumbs-aside">
      </li>
  </ul>
  <hr/>
</div>

获得预期的结果。在用make html编译源码之前是否可以得到这个结果?

【问题讨论】:

    标签: python-sphinx read-the-docs


    【解决方案1】:

    我假设您指的是面包屑 (breadcrumbs.html)。您只需打开主模板文件 - layout.html - 并删除或注释掉以下行:

    {% include "breadcrumbs.html" %}
    

    【讨论】:

    • 感谢您的回答,但在通过删除一些代码生成文件的过程之后,我已经这样做了。我将编辑我的问题以使其清楚。我想在生成html文件之前做。
    • 请重新考虑我的回答:如果您从 template 文件 - layout.html 中删除包含语句,那么它将不会出现在您的 html 输出中。生成的输出基于模板文件,因此您只需编辑一次模板。
    【解决方案2】:

    一个老问题,但我也需要这个。一个比目前接受的更简单的答案,适用于 Sphinx==3.5.3 和 sphinx-rtd-theme==0.5.2 是:

    • docs/_templates/ 中,创建一个名为breadcrumbs.html 的文件
    • 在那个文件中,写一个像&lt;!-- Empty override file take the place of env/lib/python3.8/site-packages/sphinx_rtd_theme/breadcrumbs.html, which generates the top nav breadcrumbs. --&gt;这样的html评论。

    重建,你就完成了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多