sphinx-doc / alabaster

Lightweight, configurable Sphinx theme
http://alabaster.readthedocs.io/
Other
738 stars 189 forks source link

Set menu depth #89

Open adrianandreias opened 8 years ago

adrianandreias commented 8 years ago

Any way to set the left menu options depth?

Seems that the left menu always shows the first two levels of the menu tree.

hlinander commented 7 years ago

I don't know if this is still relevant but I ran into the same problem and solved it by overriding the navigation.html template where I added the maxdepth option to the toctree invocation. This is my _templates/navigation.html:

<h3>{{ _('Navigation') }}</h3>
{{ toctree(maxdepth=4, includehidden=theme_sidebar_includehidden, collapse=theme_sidebar_collapse) }}
{% if theme_extra_nav_links %}
<hr />
<ul>
    {% for text, uri in theme_extra_nav_links.items() %}
    <li class="toctree-l1"><a href="{{ uri }}">{{ text }}</a></li>
    {% endfor %}
</ul>
{% endif %}

This assumes that you include navigation.html in the html_sidebar variable in conf.py as stated by the documentation.

bitprophet commented 7 years ago

@hlinander's approach is legit (when possible I always hope users can just use normal Sphinx tricks to work around stuff) but I would like it to be easier to tweak the depth if that is all one wants to manipulate; marking as possible enhancement, patches welcome.