Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

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

solved

Started by ian russell 9 years ago · 1 replies · 1222 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 TomW, 2 weeks ago
8 227 9 hours ago
Support · by alex, 2 months ago
8 667 23 hours ago
Support · by Supple, 5 days ago
1 98 1 day ago
Support · by TomW, 1 week ago
3 159 3 days ago
Support · by TomW, 6 days ago
2 106 5 days ago