如何在Sphinx文档中添加自定义页脚? (reStructuredText的)

时间:2011-04-07 17:39:59

标签: linux unix makefile restructuredtext python-sphinx

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

如果我将其输出为pdf格式,我发现我可能会使用conf.py的the latex preamble部分。

谢谢!

1 个答案:

答案 0 :(得分:27)

您必须通过提供如下的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']

有关模板的更多信息,请访问:http://sphinx.pocoo.org/templating.html