Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

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

solved

Started by ian russell 9 years ago · 1 replies · 1088 views
9 years ago

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.

YAML
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:

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

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

Many thanks

Ian

last edited 03/27/18 by ian russell
9 years ago

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

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

Easy when you know how!

👍 1

Suggested topics

Topic Participants Replies Views Activity
Support · by webmasterodp, 7 days ago
4 151 6 days ago
Support · by nwhitfield, 1 week ago
2 131 1 week ago
Support · by stell, 3 weeks ago
5 364 2 weeks ago
Support · by gravinator, 1 month ago
5 556 2 weeks ago
Support · by Gravver, 3 weeks ago
6 344 3 weeks ago