Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

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 · 670 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 FrViPofm, 4 weeks ago
4 471 2 weeks ago
Themes & Styling · by johan thomas, 5 years ago
1 799 3 weeks ago
Themes & Styling · by stuart young, 2 months ago
3 656 2 months ago
Themes & Styling · by Sebadamus, 3 months ago
5 678 2 months ago
Themes & Styling · by martynfoster735, 3 months ago
1 640 3 months ago