mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
Display the toctree conditionally
The `singlehtml` builder for sphinx doesn't produce a toctree, and was throwing an exception on these builds. This makes use of the `display_toc` context variable, used back to at least `sphinx==1.1`.
This commit is contained in:
parent
20747b6551
commit
398636c366
@ -121,12 +121,14 @@
|
|||||||
|
|
||||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||||
{% block menu %}
|
{% block menu %}
|
||||||
{% set toctree = toctree(maxdepth=theme_navigation_depth|int, collapse=theme_collapse_navigation, includehidden=True) %}
|
{% if display_toc %}
|
||||||
{% if toctree %}
|
{% set toctree = toctree(maxdepth=theme_navigation_depth|int, collapse=theme_collapse_navigation, includehidden=True) %}
|
||||||
{{ toctree }}
|
{% if toctree %}
|
||||||
{% else %}
|
{{ toctree }}
|
||||||
<!-- Local TOC -->
|
{% else %}
|
||||||
<div class="local-toc">{{ toc }}</div>
|
<!-- Local TOC -->
|
||||||
|
<div class="local-toc">{{ toc }}</div>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user