Skip to content
Grav 2.0 is officially stable. Read the announcement →
Themes & Styling

Retrieve sub-pages with specific template and published only

Solved by Man in the Middle View solution

Started by Yann 7 years ago · 1 replies · 605 views
7 years ago

Hello,
Currently, I'm doing the following loop to get sub-pages 🙂

{% for p in page.find('/projets').children %}

However, this also list pages which are not published. Is it possible to only list the published project ? Moreover, each sub-page has a specific page template called "Projet" (in case it can be used in the loop somehow).

Thanks for your help.

Yann

7 years ago Solution

You can use:
{% for p in page.find('/projets').children().published() %}

Don

👍 2

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by stuart young, 2 weeks ago
3 253 2 weeks ago
Themes & Styling · by Sebadamus, 3 weeks ago
5 321 3 weeks ago
Themes & Styling · by martynfoster735, 4 weeks ago
1 311 4 weeks ago
Themes & Styling · by Justin Young, 1 month ago
1 349 1 month ago
Themes & Styling · by Slebeig, 2 months ago
4 475 2 months ago