New template for Page Toc plugin compatibility

This commit is contained in:
pmoreno.rodriguez 2023-09-29 13:59:33 +02:00
parent 4feeb1531a
commit 4089e47e14
2 changed files with 35 additions and 9 deletions

View file

@ -0,0 +1,25 @@
{% 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 %}
<h3>{{ 'PLUGIN_PAGE_TOC.TABLE_OF_CONTENTS'|t }}</h3>
<ul>
{{ _self.toc_loop(table_of_contents.children) }}
</ul>
{% endif %}
</div>
{% endif %}

View file

@ -13,17 +13,18 @@
{% endblock %}
{% block footer %}
<!-- About -->
{% if theme_config.footer.title or theme_config.footer.description %}
<section class="blurb">
<h2>{{theme_config.footer.title}}</h2>
<p>{{theme_config.footer.description}}</p>
<ul class="actions">
<li><a href="{{theme_config.footer.button_url}}" class="button" aria-label="{{theme_config.footer.title}}">{{theme_config.footer.button_text}}</a></li>
</ul>
</section>
{% if page.header.toc_enabled == true and config.plugins["page-toc"].enabled %}
<div class="page-toc-sticky">
{% include 'components/page-toc.html.twig' %}
{% endif %}
{% include 'partials/sidebar-bits/footer.html.twig' %}
{% if page.header.toc_enabled == true and config.plugins["page-toc"].enabled %}
</div>
{% endif %}
{% endblock %}
</section>