
{# add heading #}
<h4>{{config.extra.toc_heading or "Contents"}}</h4>
{# add child pages #}
<blockquote style="break-inside: avoid;">
{% 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] %}
    <li>
        <a href="{{ index.obj.url | url }}">{{ index.obj.title }}</a>
    </li>
    {% endif %}
{% endfor %}
</blockquote>
