Closed EzequielBruni closed 2 years ago
Hello there,
In Twig you would access this using {{ page.children }}
. If there are no children, this will be an empty array. If there are children, you'll be able to iterate over them and create a 100 character excerpt using something like this:
{% for child in page.children %}
{{ child.body | striptags | truncate(100) }}
{% endfor %}
Or you could just list the page titles:
{% for child in page.children %}
{{ child.title }}
{% endfor %}
I hope that helps!
Thank you very much! It was a bit more complex in Typemill (which is also Twig-based), so I wanted to be sure. Your solution worked flawlessly.
BTW, this theme is intended to be open source. I obviously don't expect it to end up in the core, but is there perhaps a place where community-made themes are listed?
I've listed a few notable extensions on the wiki homepage here and at chyrplite.net. I'd be happy to add your theme to the list. Looking forward to seeing it. :-)
Here it is: https://github.com/EzequielBruni/NewFolder-Blog-ChyrpLite
It will probably need some refinement, and I'm not ready to assign the official "1.0" release thingy... but it's here. Now to do it all over again with HTMLy and Bludit because I'm an indecisive masochist.
Thanks for sharing!
So yeah, just that. How would I list immediate child pages and pull in data like a bit of the content as an excerpt? I'm building a theme where the (optional static) home page is intended to display any immediate child pages in a list to allow things like listing projects, portfolio pieces, etc.