30

如果我有一些文档,例如Galleria 的文档,我该如何设置它以便在我运行make html命令时它会在每个页面上添加一个自定义页脚?

我看到如果我将其输出为 pdf 格式,我可能会使用conf.py的乳胶前导部分。

谢谢!

4

1 回答 1

36

您必须通过提供这样的 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

于 2011-04-07T17:49:41.533 回答