Component: Child Pages (childPages)

March 16, 2021 ยท View on GitHub

Purpose

Outputs a list of child pages of the current page

Default output

The default component partial outputs a simple nested unordered list:

<ul>
    <li>
        <a href="{{ page.url | app }}">{{ page.title }}</a>
    </li>
</ul>

You might want to render the list with your own code. The childPages.pages variable is an array of arrays representing the child pages. Each of the arrays has the following items:

PropertyTypeDescription
urlstringThe relative URL for the page (use `{{ url
titlestringPage title
pageWinter\Pages\Classes\PageThe page object itself
viewBagarrayContains all the extra data used by the page
is_hiddenboolWhether the page is hidden (only accessible to backend users)
navigation_hiddenboolWhether the page is hidden in automaticaly generated contexts (i.e menu)

Example of custom markup for component

{% for page in childPages.pages %}
    <li><a href="{{ page.url | app }}">{{ page.title }}</a></li>
{% endfor %}