2

I'm trying to limit the depth of sidebar toc generated by Sphinx HTML Biulder. I tried to change localsidebar.html with my own but I couldn't find any hints in the documentation, just the deprecated options. {{ toc }} contains rendered local toc but there's no info about how to work with it before it gets rendered.

2
  • Have you had any success so far? I have the same question. Commented Jun 5, 2014 at 11:15
  • @creimers unfortunately no. Commented Jun 5, 2014 at 22:29

2 Answers 2

3

Try putting the following line at the top of the file:

:tocdepth: <n> 

with <n> being the depth you want.

Sign up to request clarification or add additional context in comments.

Comments

0

I've seen the best sidebar results by setting maxdepth in the theme customizations in _templates/layout.html. No extra directive options are needed in the rst toctree file hierarchy.

{%- block sidebartoc %} {{ toctree(collapse=False,maxdepth=2) }} {%- endblock %} 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.