How to display sub tree structure as a ToC

Is there any way in which I could achieve to display on a page all its sub tree pages as a ToC that updates by itself?

This would mean having a redirecting directory on a page. Something like this:


Documentation

Mail
    How to synch with Android
Cloud
    Using Nextcloud Calendar
    Importing existing contacts into Nextcloud
Mastodon
    Migrating from an instance to another

Just like a ToC, but instead of for the page’s content, listing pages on sub directories.

@porru, Essentially, the logic is the same as how a menu is build.

  • See Quarks ‘/user/themes/quark/templates/macros/macro.html.twig’.
  • Or have look at the way the menu is created in theme Learn. This is the theme used for the docs

In essence:

  1. Loop through the child collection of ‘pages’ (or specific page)
  2. For each child, print its properties (e.g. title, description and url)
    a. For each child, check for children
    • For each child, go to 1