Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

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 · 766 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 MarkP, 2 weeks ago
3 193 2 weeks ago
Themes & Styling · by TomW, 2 weeks ago
0 111 2 weeks ago
Themes & Styling · by themetman, 3 weeks ago
1 206 3 weeks ago
Themes & Styling · by AH, 1 month ago
1 324 3 weeks ago
Themes & Styling · by Bruno, 4 years ago
6 1523 3 weeks ago