- Description:
This key represents a sort option for a Collection.
- Appears in:
└── collections_config └── * └── sort_options └── [*]- Type:
Object- Properties:
This key defines which key an option in the Sort dropdown should use to sort files in your Collection browser.
You must define this key for every entry in the
sort_optionsarray for the object to function.Value must be the name of a structured data key in your Collection files.
If some files in your Collection do not have this data key, CloudCannon will sort those in ascending alphabetical order, after the file sorted by your data key in the Collection browser.
Show examplesHide examples
In this example, the "Author (A-Z)" option in the Sort dropdown will use the
authorkey to sort files in theblogCollection browser.Copied to clipboardcollections_config: blog: sort_options: - key: author order: ascending label: Author (A-Z){ "collections_config": { "blog": { "sort_options": [ { "key": "author", "order": "ascending", "label": "Author (A-Z)" } ] } } }This key defines the label used for a file sorting option in the Sort dropdown.
Show examplesHide examples
In this example, the sorting method which uses the
authorkey is called "Author (A-Z)" in the Sort dropdown.Copied to clipboardcollections_config: blog: sort_options: - key: author order: ascending label: Author (A-Z){ "collections_config": { "blog": { "sort_options": [ { "key": "author", "order": "ascending", "label": "Author (A-Z)" } ] } } }This key defines which order an option in the Sort dropdown should use to sort files in your Collection browser.
CloudCannon will sort files according to the value of
sort_options[*].keyfor each option in the Sort dropdown.Defaults to:
ascendingAllowed values:
ascendingdescendingascdescShow examplesHide examples
In this example, the "Author (A-Z)" option in the Sort dropdown will sort files in the
blogCollection browser in ascending order.Copied to clipboardcollections_config: blog: sort_options: - key: author order: ascending label: Author (A-Z){ "collections_config": { "blog": { "sort_options": [ { "key": "author", "order": "ascending", "label": "Author (A-Z)" } ] } } }- Examples: