Return a collection of child elements to the grandparent page and make it editable in the blueprint

Hello,

In the Reference, i saw that.

I have a Folder Structure like this:

  • Home
    • Collection Folder 1
      • Collection Folder Item 1
      • Collection Folder Item 2
    • Collection Folder 2

I want to return all listed Collection Items of one Collection Folder on the Home-Page.

I did this (home.php):

  <?php foreach(page('CollectionFolder1')->children() as $CollectionItem): ?>
    <div>
      <h2><?= $CollectionItem->title() ?></h2>
      <p><?= $CollectionItem->text() ?></p>
    </div>
  <?php endforeach ?>

Also: How can i built a Blueprint for the Home-Page that shows a Pages Section within the CollectionItems and not the CollectionFolders.
In my Backend it just shows my 3 CollectionFolder-Pages…

I have this (home.yml):

sections:
  CollectionFolder1:
    type: pages
    layout: list
  CollectionFolder2:
    type: pages
    layout: list

This page doesn’t exist, you need to pass the full path to the page to the page() helper, so

page('home/collectionfolder1')

Make sure that the slug is typed correctly, you should not use spaces or camelCase in folder names (not possible when pages are created via the Panel anyway).

As regards your second question: You have to set the parent property.

1 Like

Just to make this Post a bit more helpful for everyone.

The Solution for the Subpages in a Blueprint is:

  sections:
    CollectionFolder:
      type: pages
      layout: list
      parent: site.find("home/CollectionFolder")

Source Thread