用sphinx_book_theme构建sphinx
我正在尝试将sphinx与 sphinx beam theme 在我的文档中构建文档的问题。
设置
我安装了sphinx和主题的
pip install sphinx
pip install sphinx_book_theme
sphinx-quickstart
,并使用以下文档启动了:然后我将主题更改为phinx beam them
我的conf.py
看起来像这样(已删除自动化注释):
# -- Project information -----------------------------------------------------
project = 'mytest'
copyright = '2022, Me'
author = 'Me'
release = '0.1.0'
# -- General configuration ---------------------------------------------------
extensions = [
'sphinx_book_theme' # I changed this
]
templates_path = ['_templates']
language = 'python'
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
html_theme = 'sphinx_book_theme' # I changed this
html_static_path = ['_static']
构建
但是,当我尝试构建文档时,
sphinx-build docs . _build/html
:我会收到此错误:
Running Sphinx v4.5.0
loading translations [python]... not available for built-in messages
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
Theme error:
An error happened in rendering the page index.
Reason: TemplateNotFound('sidebar-logo.html')
如何解决此问题并使用书籍主题?我需要创建一个侧边栏模板吗?如果是这样,如何以及在哪里?我没有针对我的项目的徽标,也不想创建一个徽标。
I'm trying to use Sphinx with Sphinx book theme in my documentation but I'm having problems building the docs.
Setup
I installed Sphinx and the theme and initiated the docs with:
pip install sphinx
pip install sphinx_book_theme
sphinx-quickstart
Then I changed the theme to Sphinx book theme as described in the docs by adding the extension and changing the HTML theme in the conf.py
.
My conf.py
looks like this (removed autogenerated comments):
# -- Project information -----------------------------------------------------
project = 'mytest'
copyright = '2022, Me'
author = 'Me'
release = '0.1.0'
# -- General configuration ---------------------------------------------------
extensions = [
'sphinx_book_theme' # I changed this
]
templates_path = ['_templates']
language = 'python'
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
html_theme = 'sphinx_book_theme' # I changed this
html_static_path = ['_static']
Building
However, when I try to build the docs:
sphinx-build docs . _build/html
I get this error:
Running Sphinx v4.5.0
loading translations [python]... not available for built-in messages
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
Theme error:
An error happened in rendering the page index.
Reason: TemplateNotFound('sidebar-logo.html')
How do I fix this and use the book theme? Do I need to create a sidebar template? If so, how and where? I don't have a logo for my project and would not like to create one at this moment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己找到了答案。似乎如果您删除行
templates_path = ['_templates']
它有效:如果您在
>“模板”中有某些内容
,我怀疑您需要创建sidebar -logo.html
在这里。不确定如何。I found the answer myself. It seems if you remove the line
templates_path = ['_templates']
it works:If you have something in the
templates
, I suspect you need to create thesidebar-logo.html
here. Not sure how though.