如何在 Sphinx Alabaster 主题下编辑侧边栏 [英] How to edit Sidebar under Sphinx Alabaster theme
本文介绍了如何在 Sphinx Alabaster 主题下编辑侧边栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下 index.rst
文件.
Know the cell population of your data
=====================================
Some content
.. toctree::
:maxdepth: 2
Installation
~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
installation
Scripts
~~~~~~~
.. toctree::
:maxdepth: 2
scripts
API documentation
~~~~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
apidoc
Roadmap
~~~~~~~
.. toctree::
:maxdepth: 2
roadmap
Indices and Tables
==================
* :ref: `genindex`
现在侧边栏看起来像这样:
Now the sidebar looks like this:
如该图片中所述.我想做几件事.
As described in that image. I'd like to do couple of things.
- 删除侧边栏中的仅标题,但在主页面中保留它.
- 添加新的 URL 链接,但不会像索引和表格"那样在主页中显示
- remove the title only in the sidebar but maintaining it in the main page.
- add new URL link, but not showing it in the main page like "Indices and Tables"
我该怎么做?
推荐答案
我最终通过以下方式修复了它
I finally fixed it the following way
在 Sphinx 的 _template 目录中创建一个文件称为 foo.html
.
In the Sphinx's _template directory create a file
called foo.html
.
内容可能如下所示:
<hr />
<p>
<h2 class='logo'>
<a href="https://foo.bar.com/">Web Version</a>
</h2>
</p>
最后在 conf.py 中添加:
html_sidebars = {
'**': [
'localtoc.html',
'relations.html',
'searchbox.html',
# located at _templates/
'foo.html',
]
}
最后是这样的:
这篇关于如何在 Sphinx Alabaster 主题下编辑侧边栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文