<nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">

  <div class="bd-toc-item active">
    {% if "python/api" in pagename or "python/generated" in pagename %}
    {{ generate_toctree_html("sidebar", startdepth=0, maxdepth=3, collapse=False, includehidden=True, titles_only=True) }}
    {% else %}
    {{ generate_toctree_html("sidebar", startdepth=0, maxdepth=4, collapse=False, includehidden=True, titles_only=True) }}
    {% endif %}
  </div>
</nav>