Skip to content
Grav 2.1 is out: every page speaks Markdown. 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 · 631 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, 23 hours ago
1 35 10 hours ago
Themes & Styling · by stuart young, 1 month ago
3 480 1 month ago
Themes & Styling · by Sebadamus, 2 months ago
5 481 2 months ago
Themes & Styling · by martynfoster735, 2 months ago
1 460 2 months ago
Themes & Styling · by Justin Young, 2 months ago
1 491 2 months ago