【问题标题】:Enabling sidebar on Python-Sphinx documentation based on a sphinx-bootstrap-theme基于 sphinx-bootstrap-theme 在 Python-Sphinx 文档上启用侧边栏
【发布时间】:2014-01-05 21:45:48
【问题描述】:

我正在使用漂亮的 sphinx-bootstrap-theme 0.3.4 并尝试在 Sphinx Python 文档生成器 1.2 版之上应用它。

当我通过make html 构建文档时,我没有看到任何侧边栏,尽管在example 中显示它是可能的。两者都没有,我能够在构建配置文件(conf.py)中找到启用侧边栏的任何选项。 执行以下操作:

html_sidebars = {'sidebar': ['localtoc.html', 'sourcelink.html', 'searchbox.html']}

没用。

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

【问题讨论】:

    标签: python-sphinx


    【解决方案1】:

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

    html_sidebars = {'**': ['localtoc.html', 'sourcelink.html', 'searchbox.html']}
    

    以此为参考

    Sphinx theming guide html_sidebars

    我正在尝试创建自定义侧边栏,因为我不喜欢包含的选项。使用引导演示 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>
    

    然后编辑html_sidebars

    html_sidebars = {'**': ['my_custom_sidebar.html', 'searchbox.html']}
    

    【讨论】:

    • 它为theme_globaltoc_depth 抛出错误。以防万一,请将其删除。
    • 谢谢!正是我所追求的。节省了我的时间!
    猜你喜欢
    • 1970-01-01
    • 2013-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-27
    • 1970-01-01
    • 2016-01-06
    相关资源
    最近更新 更多