{% import 'macros/macros.html.twig' as toc_macros %}

{% if active or toc_config_var('active') %}
<div class="page-toc">
    {% set table_of_contents = toc_items(page.content) %}
    {% if table_of_contents is not empty %}
        <h3>{{ 'PLUGIN_PAGE_TOC.TABLE_OF_CONTENTS'|t }}</h3>
        <ul>
            {{ toc_macros.toc_loop(table_of_contents.children) }}
        </ul>
    {% endif %}
</div>
{% endif %}