Learn 2 theme - Customizing loop on page

Hi Everyone,

As it’s my first post here, I’m glad to join the grav community. I’m using grav to manage a collection of Lyrics for my passion : Capoeira !

So I used the learn2 theme that fits my needs ! I successfully customize the theme but I’m still facing an issue and someone is maybe able to help me.

I created my own folder structure defining my chapters. In each chapter I have my pages.

Currently, the pages corresponding to these folder are displaying like this :

http://www.abada-lyon.com/aclmusic/angola

You can see that after the content (only the title in fact), there’s a loop function from the chapter twig template that lists all the pages…But it make a list with every page on my website. What I would like to do, is only show a list of pages included in the current chapter !

In the example of my linked page : I would like to see only the line “Sou capoeira eu vou levando a vida” as it is the only page in Angola Chapter.

I went across the chapter.html.twig code that generate this list, but did not succeed to customise the code to my needs…

Here is the code :

{% extends 'partials/base.html.twig' %}
{% set tags = page.taxonomy.tag %}
{% if tags %}
    {% set progress = page.collection({'items':{'@taxonomy':{'category': 'docs', 'tag': tags}},'order': {'by': 'default', 'dir': 'asc'}}) %}
{% else %}
    {% set progress = page.collection({'items':{'@taxonomy':{'category': 'docs'}},'order': {'by': 'default', 'dir': 'asc'}}) %}
{% endif %}




{% block content %}
	<div id="chapter">
    	<div id="body-inner">
			<p>
				{{ page.content }}

			</p>
		</div>
    </div>

{% macro loop(page, parent_loop) %}
    {% if parent_loop|length > 0 %}
        {% set data_level = parent_loop %}
    {% else %}
        {% set data_level = 0 %}
    {% endif %}
    {% for p in page.children.visible %}
        {% set parent_page = p.activeChild ? ' parent' : '' %}
        {% set current_page = p.active ? ' active' : '' %}
        <li class="dd-item{{ parent_page }}{{ current_page }}" data-nav-id="{{ p.route }}">
            <a href="{{ p.url }}" {% if p.header.class %}class="{{ p.header.class }}"{% endif %}>
                <i class="fa fa-check read-icon"></i>
                <span><b>{% if data_level == 0 %}{{ loop.index }}. {% endif %}</b>{{ p.menu }}</span>
            </a>
            {% if p.children.count > 0 %}
            <ul>
                {{ _self.loop(p, parent_loop+loop.index) }}
            </ul>
            {% endif %}
        </li>
    {% endfor %}
{% endmacro %}

{% macro version(p) %}
    {% set parent_page = p.activeChild ? ' parent' : '' %}
    {% set current_page = p.active ? ' active' : '' %}
    <h5 class="{{ parent_page }}{{ current_page }}">
        {% if p.activeChild or p.active %}
        <i class="fa fa-chevron-down fa-fw"></i>
        {% else %}
        <i class="fa fa-plus fa-fw"></i>
        {% endif %}
        <a href="{{ p.url }}">{{ p.menu }}</a>
    </h5>
{% endmacro %}

<div class="scrollbar-inner">
    <div class="highlightable">
        {% if theme_config.top_level_version %}
            {% for slug, ver in pages.children %}
                {{ _self.version(ver) }}
                <ul id="{{ slug }}" class="topics">
                {{ _self.loop(ver, '') }}
                </ul>
            {% endfor %}
        {% else %}
            <ul class="topics">
                {% if theme_config.root_page %}
                    {{ _self.loop(page.find(theme_config.root_page), '') }}
                {% else %}
            {{ _self.loop(pages, '') }}
                {% endif %}
            </ul>
        {% endif %}

    </div>
</div>




{% endblock %}

Thanks in advance for any help !!

Regards !!