如何在Sphinx文档中添加自定义页脚?(reStructuredText) [英] How can I add a custom footer to Sphinx documentation? (reStructuredText)

查看:62
本文介绍了如何在Sphinx文档中添加自定义页脚?(reStructuredText)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一些文档,例如画廊的文档,怎么办我进行了设置,以便当我运行 make html 命令时,它将在每个页面上添加自定义页脚吗?

If I have some documentation, like for example Galleria's documentation, how can I set it up so that when I run the make html command it will add a custom footer on to each page?

我发现我可能会使用乳胶序言conf.py部分,如果我将其输出为pdf格式.

I saw that I could potentially use the latex preamble section of conf.py if I was outputting it to a pdf format.

谢谢!

推荐答案

您必须通过提供如下html文件来扩展默认布局:

You have to extend the default layout by providing an html file like this:

{% extends '!layout.html' %}

{% block footer %}
        <!-- your html code here -->
{% endblock %}

将其保存为 layout.html _templates/子目录中,并确保告诉 conf.py 在哪里可以找到此目录:

Save this in a _templates/ subdirectory as layout.html and make sure to tell conf.py where to find this directory:

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

有关模板的更多信息,请参见: https://www.sphinx-doc.org/en/master/templating.html

More information on templating can be found here: https://www.sphinx-doc.org/en/master/templating.html

这篇关于如何在Sphinx文档中添加自定义页脚?(reStructuredText)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆