2024-05-17 20:26:01 +02:00
|
|
|
|
2022-06-06 18:16:01 +02:00
|
|
|
{% macro toc_loop(items) %}
|
2024-05-17 20:26:01 +02:00
|
|
|
|
2022-06-06 18:16:01 +02:00
|
|
|
{% for item in items %}
|
|
|
|
{% set class = loop.first ? 'first' : loop.last ? 'last' : null %}
|
|
|
|
<li {% if class %}class="{{ class }}"{% endif %}>
|
2024-05-17 20:26:01 +02:00
|
|
|
<a href="{{ item.uri }}">{{ item.label | raw }}</a>
|
2022-06-06 18:16:01 +02:00
|
|
|
{% if item.children|length > 0 %}
|
|
|
|
<ul>
|
2023-08-03 16:57:09 +02:00
|
|
|
{{ _self.toc_loop(item.children) }}
|
2022-06-06 18:16:01 +02:00
|
|
|
</ul>
|
|
|
|
{% endif %}
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% 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 %}
|
|
|
|
<h4>{{ 'PLUGIN_PAGE_TOC.TABLE_OF_CONTENTS'|t }}</h4>
|
|
|
|
<ul>
|
2023-08-03 16:57:09 +02:00
|
|
|
{{ _self.toc_loop(table_of_contents.children) }}
|
2022-06-06 18:16:01 +02:00
|
|
|
</ul>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2024-05-17 20:26:01 +02:00
|
|
|
{% endif %}
|