从 html 中删除上一个和下一个主题,sphinx

Remove previous and next topic from html, sphinx

我想从我的 html 页面中删除 Next topicPrevious topic

我尝试在 conf.pyhtml_theme_options 中将 prev_next_buttons_location 设置为 False 但我收到 WARNING 告诉我此选项不适用于我当前的主题(自然)。

另一种删除它们的方法是不声明来自 index 的 table 的其他 rst 来源内容(我的文档的第一个版本只有 index.rst 而我没有 NextPrevious 按钮):我尝试使用 [=21] 的标志 :hidden: =] 但我还有它们。删除 .. toctree:: 不是解决方案,因为我对每个未声明的文件都有 WARNINGS

我应该将我的主题更改为另一个支持 prev_next_buttons_location 的主题吗? (我真的不想换主题了)

有没有办法从我生成的页面中删除按钮?

问题的另一种表达方式是:如何不将某些文件包含到 toctree 中?

首先我尝试在 exclude_patterns 中添加文件,但后来它们没有生成到 html。我回到文档并阅读了这篇文章

Use exclude_patterns to explicitly exclude documents or directories from building completely. Use the “orphan” metadata to let a document be built, but notify Sphinx that it is not reachable via a toctree.

然后我按照 link 关于 "orphan" 元数据:https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html#metadata

这是解决方案:只需在文件开头添加 :orphan:。正如文档中所写:

If set, warnings about this file not being included in any toctree will be suppressed.

所以,这解决了问题。