in item.children -%}
          {{ render_toc_item(subitem, level + 1) }}
        {%- endfor -%}
      </ul>
    {%- endif -%}
  </li>
{%- endmacro -%}

{%- macro render_toc(item) -%}
  {%- if item.active and item == page -%}
    {% set toc = page.toc %}
    {% set first = toc | first %}
    {% if first and first.level == 1 %}
      {% set toc = first.children %}
    {% endif %}
    <ul class="esi-sidebar-nav esi-sidebar-nav-toc" data-md-component="toc">
      {%- for item in toc -%}
        {{ render_toc_it