summaryrefslogtreecommitdiff
path: root/alabaster-lite/sidebars/toc.html
blob: cce0f4a0bf67d30d3486068bd78a92029979a90f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{% macro _toc_tree_inner(toc) -%}
  <ul>
    {% for toc_item in toc %}
      <li><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
      {{ _toc_tree_inner(toc_item.children) }}
    {% endfor %}
  </ul>
{%- endmacro %}

{% macro toc_tree(toc) -%}
  {# This ignores H1s #}
  {% for toc_item in toc %}
    {{ _toc_tree_inner(toc_item.children) }}
  {% endfor %}
{%- endmacro %}

<nav>
  {{ toc_tree(page.toc) }}

  {% if theme.extra_nav_links %}
    <hr>
    <ul>
      {% for text, uri in theme.extra_nav_links.items() %}
        <li class="toctree-l1"><a href="{{ uri }}">{{ text }}</a></li>
      {% endfor %}
    </ul>
  {% endif %}
</nav>