sort - Liquid Filter Reference
On this page
Description
Sorts items in an list in case-sensitive order.
| Property | Value |
|---|---|
| Return Type | list |
| Category | lists |
Examples
liquid
{{ array | sort | join: ", " }}
Output: Water, air, earth, fire
An optional argument specifies which property of the list’s items to use for sorting
```liquid {% assign pages_by_title = pages | sort: “title” %}
{% for page in pages_by_title -%} - {{ page.title }} {% endfor %} ```
Output: - About Us\n- Home\n- Privacy Policy