如果我有一些文档,例如 Galleria's documentation ,如何设置它以便在我运行 make html
命令时它会向每个页面添加自定义页脚?
我发现我可以使用 the LaTeX preamble conf.py
部分(如果我将其输出为 PDF 格式)。
最佳答案
您必须通过提供如下 html 文件来扩展默认布局:
{% extends '!layout.html' %}
{% block footer %}
<!-- your html code here -->
{% endblock %}
将其保存在 _templates/
子目录中作为 layout.html
并确保告诉 conf.py
在哪里可以找到该目录:
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
可在此处找到有关模板的更多信息:https://www.sphinx-doc.org/en/master/templating.html
关于templates - 如何向 Sphinx 文档添加自定义页脚?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5585250/