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 · 501 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 Pedro M, 2 months ago
4 241 2 months ago
Themes & Styling · by Ian, 2 months ago
3 123 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 488 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 75 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 156 3 months ago