Display Subpages within a section Main-Page

Dearest Kirby-Community,

I have created a one-page page with Kirby. Each visible Page is displayed as a section of the One-Page. In the last section I want to display “our” Team.
I thought that the most dynamic way would be, to create a subpage to the page “team”, for each member. That way each member could be edited easily from the backend and for each new member you’d have to create a subpage, fill out the fields and set visible - et voilá the new member should be displayed on the frontend.
Sadly, this does not work the way I want to.
Somehow the visible Subpages do not appear.

After reading the Doc I tried the following:

<h2>Team< /h2>
<?php foreach($page->children() as $subpage): ?>
     <a href="<?php echo $subpage->url() ?>">
       <?php echo html($subpage->title()) ?>
<?php endforeach ?>

(spaces on purpose for posting here)

Later on I will then fetch the Information set on each subpage.
But not even displaying the Titles works out for me.

Do you have an idea on how to make this work?

I appreciate every thought that could push me in the right direction.

Thank you all very much.

Best Regards.

If you are using $page on the home template, it refers to the current page, which is home, and probably does not have any children.

Do you use that code within a snippet? Have you followed the one-pager tutorial?

Please do not use spaces to post your code, but wrap code blocks within three backticks on a separate line before and after your code block. Thank you!

Oh, sorry - next time I will use the codewrap!

I just checked again and realized I have to use $data->children() if used in a section.
Thank you for pointing this out to me.


Just another question came along:
I am using the Revision plugin, now there is “Revisions” showing up as a subpage. What would be the best way to exclude “Revisions” from being displayed?


If your other subpages are visible, then you could filter by visibility:

$children = $data->children()->visible();

(assuming that revisions is “invisible” (i.e. no number prepended)

You can also just exclude the revisions subpage

$children = $data->children()->not('revisions');