Please explain how to use the "custom" ordering method for a collection

How should I implement custom variables as described in the following excerpt from Page Collections in the Grav Documentation?

What is not clear to me is how to include a custom variable in a blog-item page, e.g. _showcase.

content:
order:
    by: default
    custom:
        - _showcase
        - _highlights
        - _callout
        - _features
limit: 5
pagination: true

In the above configuration, you can see that content.order.custom is defining a custom manual ordering to ensure the page is constructed with the showcase first, highlights section second etc. Please note that if a page is not specified in the custom ordering list, then Grav falls back on the content.order.by for the unspecified pages.

The collection comes from taxonomy values:

- { '@taxonomy.category': a }
- { '@taxonomy.category': b }

What I want to do is ‘showcase’ certain items at the top of the list.

Many thanks

Ian

Problem solved: include folder names in the custom ordering list.

order:
    by: default
    custom:
        - ds4800
        - ds2208
        - ds2278
show_date: false

Easy when you know how!

1 Like