Hi folks,
to create and show a page collection via
{% set options = { items: {'@page.children': '/myfolder'}, 'order': {'by': 'title', 'dir': 'desc'} } %}
{% set my_collection = page.collection(options) %}
<ul>
{% for p in my_collection %}
<li>{{ p.title|e }}</li>
{% endfor %}
</ul>
within a myfile.html.twig works fine. The structure of folders and files (and titles) is this:
04.myfolder ()
–01.subfolder_a (default.md - title ‘lorem’)
–02.subfolder_b (default.md - title ‘ipsum’)
–03.subfolder_c (default.md - title ‘dolor’)
I’d like to know how I can affect the ordering by using manual or custom. After one and a half hour of searching the learning section ( Page Collections | Grav Documentation (getgrav.org)) and several forum entries I ended up with no success at all. I tried this e.g.:
{% set options = { items: {'@page.children': '/footer'}, 'order': {'by': 'custom', 'custom': '01.subfolder_a|03.subfolder_c|02.subfolder_b'} } %}
{% set my_collection = page.collection(options) %}
with and without the numbers, using , instead of | and many other firings into the blue containing added frontmatter information in variable ways.
So, any help is appreciated. Thank you!
Greetings,
Markus