{% set default_depth = theme_default_toctree_depth | int %}
{% set ttree = namespace(depth=default_depth) %}
{% for config_prefix, config_depth in theme_page_toctree_depths.items() %}
{% if pagename.startswith(config_prefix) %}
{% set ttree.depth = config_depth | int %}
{% endif %}
{% endfor %}
{% set toctree = toctree(maxdepth=ttree.depth, collapse=True, includehidden=True) %}

{% if toctree %}
{% if logo %}
<div class="sidelogo">
    <img class="sidelogo" src="{{ pathto('_static/' + logo, 1) }}">
</div>
{% else %}
<div class="sidenologo"></div>
{% endif %}
<p class="doc-title">
    <a style="padding-left: 0" href="{{ pathto('index') }}">{{ project|e }} {{ release|e }}</a>
</p>
<form class="navbar-form navbar-right" action="{{ pathto('search') }}" method="get">
    <div class="form-group">
        <label>
            <input type="text" name="q" class="form-control" placeholder="Search" />
        </label>
    </div>
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
</form>
{{ toctree }}
{% else %}
<div class="local-toc">{{ toc }}</div>
{% endif %}
