This key defines the options for the Sort dropdown in a Collection browser.
Configuring sort options for a Collection will remove CloudCannon's default sorting options from the Sort dropdown.
By default, CloudCannon provides sorting options for path, file size, file creation time, and last modified, in ascending and descending order.
CloudCannon will also read data keys from your early Collection files and provide options to sort by those key values.
Appears in
└── collections_config
└── *
└── sort_optionsType
Array<sort_options[*]>
Items
This key represents a sort option for a Collection.
Appears in: *.sort_options.
Examples
In this example, the Sort dropdown in the blog Collection browser only contains options for sorting by author and date in ascending and descending order.
Copied to clipboard
collections_config:
blog:
sort_options:
- key: author
order: ascending
label: Author (A-Z)
- key: author
order: descending
label: Author (Z-A)
- key: date
order: ascending
label: Date (Newest First)
- key: date
order: descending
label: Date (Oldest First){
"collections_config": {
"blog": {
"sort_options": [
{
"key": "author",
"order": "ascending",
"label": "Author (A-Z)"
},
{
"key": "author",
"order": "descending",
"label": "Author (Z-A)"
},
{
"key": "date",
"order": "ascending",
"label": "Date (Newest First)"
},
{
"key": "date",
"order": "descending",
"label": "Date (Oldest First)"
}
]
}
}
}