{# Restrict the sidebar toc depth to two levels while generating command usage pages. This avoids superfluous entries for each "Description" and "Examples" heading. #} {% if pagename.startswith("usage/") and pagename not in ( "usage/general", "usage/help", "usage/debug", "usage/notes", ) %} {% set maxdepth = 2 %} {% else %} {% set maxdepth = 3 %} {% endif %} {% set toctree = toctree(maxdepth=maxdepth, collapse=True) %} {% if toctree %} {{ toctree }} {% else %} {{ toc }} {% endif %}