27 lines
841 B
Twig
27 lines
841 B
Twig
{% import _self as self %}
|
|
|
|
{% macro toc_loop(items) %}
|
|
{% for item in items %}
|
|
{% set class = loop.first ? 'first' : loop.last ? 'last' : null %}
|
|
<li {% if class %}class="{{ class }}"{% endif %}>
|
|
<a href="{{ item.uri }}">{{ item.label }}</a>
|
|
{% if item.children|length > 0 %}
|
|
<ul>
|
|
{{ self.toc_loop(item.children) }}
|
|
</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>
|
|
{{ self.toc_loop(table_of_contents.children) }}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %} |