基于sphinx-bootstrap-theme在Python-Sphinx文档上启用侧栏

man*_*aia 11 python-sphinx

我正在使用漂亮的sphinx-bootstrap-theme 0.3.4并尝试将其应用于Sphinx Python Documentation Generator 1.2版之上.

当我构建文档时make html,我没有得到任何侧边栏,虽然在这个例子中显示它是可能的.两者都没有,我能够在构建配置文件(conf.py)中找到任何启​​用侧栏的选项.执行以下操作:

html_sidebars = {'sidebar': ['localtoc.html', 'sourcelink.html', 'searchbox.html']}
Run Code Online (Sandbox Code Playgroud)

没有帮助.

感谢您提供有关如何通过这样的Sphinx主题启用侧边栏的任何提示.

fre*_*red 17

刚想通了.这应该可以解决问题.

html_sidebars = {'**': ['localtoc.html', 'sourcelink.html', 'searchbox.html']}
Run Code Online (Sandbox Code Playgroud)

以此为参考

狮身人面像主题指导html_sidebars

我正在尝试创建自定义侧边栏,因为我不喜欢包含的选项.使用bootstrap demo index.html我为自定义侧边栏创建了以下内容.只需my_custom_sidebar.html将其命名为/ source/_templates即可

<ul class="globaltoc"
>{{ toctree(maxdepth=theme_globaltoc_depth|toint, collapse=False,includehidden=theme_globaltoc_includehidden|tobool) }}</ul>
Run Code Online (Sandbox Code Playgroud)

然后编辑 html_sidebars

html_sidebars = {'**': ['my_custom_sidebar.html', 'searchbox.html']}
Run Code Online (Sandbox Code Playgroud)