Display pages with the same category

Hello,

I want to display the other pages with the same category as the current page. I added this code in blog_item.html.twig which displays all the pages right now :

<ul class="liste-articles">
{% for p in page.parent.children if p != page %}
    <li>
        <a href="{{ p.url }}">{{ p.title }}</a>
    </li>
{% endfor %}
</ul>

Thank you in advance for your help !

Please read the taxonomy documentation

Thank you,
I have read this page without finding a solution to my problem…
If anyone has an idea, I’m a taker !

What you described is searching via taxonomies. What you really wanted to do: get all the siblings (what you meant with cartegory is a folder) of the actual page on the same level.

You might be looking for this: https://learn.getgrav.org/content/collections#self-siblings-all-the-sibling-pages

Hello,

Thank you for your help but I don’t think I have been clear enough, sorry I’m French and I have trouble expressing myself correctly in English.

Simply put: All my articles are subpages of the home page that display them. At the end of each subpage, I want to display the other articles that have the same category as the current subpage. Currently, all subpages are displayed at the end of each article.

I hope I have been clear and thank you in advance for your help.