diff options
Diffstat (limited to 'alabaster-lite/sidebars/toc.html')
-rw-r--r-- | alabaster-lite/sidebars/toc.html | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/alabaster-lite/sidebars/toc.html b/alabaster-lite/sidebars/toc.html new file mode 100644 index 0000000..cce0f4a --- /dev/null +++ b/alabaster-lite/sidebars/toc.html @@ -0,0 +1,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> |