Fetch pages from specific folder


For navigation, I would like to list all pages inside a specific content folder; the folder happens to be named “etc”.

The output should be a list of links like this:

<li><a href="URL-to-page-1" title="title-of-page-1">Title of page 1</a></li>
<li><a href="URL-to-page-2" title="title-of-page-2">Title of page 2</a></li>
<li><a href="URL-to-page-3" title="title-of-page-3">Title of page 3</a></li>

Basically listing all pages inside the folder “etc”. I tried filters and search functions, but I didn’t get it to work. Thank you for your help.

$navItems = page('etc')->children()->visible();

(or without visible). And provided that the page is a first level page.

Then loop through collection.

Hi texnixe

Thank you for your fast reply. It works.