Rendering child pages
Created 7 years ago by sir_vinceIn an effort to ease construction of complex pages have I run into the need to render child pages. What I'm trying to accomplish could be described as the following: {% for child in page.children %} {{ child.render() | raw }} {% endfor %}
And what would happen here is the layout of the given child page is rendered with all the values set for the given page. Am I just missing something or is this not part of the design?
Thanks
You won't be able to do this in the layout though I don't think because of recursion.. It'd be in the page content somewhere. Maybe a page type and slap it in an editor field. Ill checkout how to avoid the recursion but.. content uses the type layout so it's not really avoidable most likely.
A simple example out of the box (2 = the contact page that's seeded but you could use your loop too):
<p>Welcome to PyroCMS!</p>
{{ page(2).content()|raw }}
Try
{{ child.content()|raw }}