{# add heading #}

{{config.extra.toc_heading or "Contents"}}

{# add child pages #}
{% for item in page.parent.children %} {# use a namespace so that we can set stuff within a sub-for loop #} {% set index = namespace(obj=item) %} {# if item is a section, navigate to its index page #} {% if item.is_section %} {% for child in item.children if child.is_index %} {% set index.obj = child %} {% endfor %} {% endif %} {# create list item #} {% if item != page.parent.children[0] %}
  • {{ index.obj.title }}
  • {% endif %} {% endfor %}