我正在使用狮身人面像。我想把它模板化。所以在阅读了文档之后,我正在尝试的是,在我的 conf.py 中,
我放了一条线,
templates_path = ['_templates']
我创建了一个文件
_templates/page.html
但这不会覆盖 sphinx 提供的默认模板。我还应该做什么,这个模板需要去哪里?
编辑:
评论中的目录结构:
conf.py
abc.txt
def.txt
makefile
_templates\
page.html
我正在使用狮身人面像。我想把它模板化。所以在阅读了文档之后,我正在尝试的是,在我的 conf.py 中,
我放了一条线,
templates_path = ['_templates']
我创建了一个文件
_templates/page.html
但这不会覆盖 sphinx 提供的默认模板。我还应该做什么,这个模板需要去哪里?
编辑:
评论中的目录结构:
conf.py
abc.txt
def.txt
makefile
_templates\
page.html
文档https://www.sphinx-doc.org/en/master/templating.html#working-with-the-builtin-templates
说它正在寻找的模板是layout.html
.
也许您应该使用该名称。
这对我有用。也许您需要使用命令强制重建所有文件sphinx-build -a
?Sphinx 仅编译它检测到已更改的 HTML 文件。另一种选择是使用touch *.rst
.