- Description:
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_options- Type:
Array<sort_options[*]>- Items:
- Examples:
In this example, the Sort dropdown in the
blogCollection browser only contains options for sorting byauthoranddatein ascending and descending order.Copied to clipboardcollections_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)" } ] } } }