Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

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

solved

Started by ian russell 8 years ago · 1 replies · 859 views
8 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
8 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 Thomas, 1 week ago
2 57 15 hours ago
Support · by Anna, 3 days ago
2 65 18 hours ago
Support · by Justin Young, 18 hours ago
1 33 18 hours ago
Support · by Duc , 1 week ago
2 68 5 days ago
Support · by Colin Hume, 1 week ago
2 60 6 days ago