Sort
Sorts the items of an array. With a property name, the filter sorts the items by the value of this property. The sort is case-sensitive: uppercase letters come before lowercase letters.
liquid
{{ array | sort: property }}Example
Data
json
{
"colors": [
"red",
"Blue",
"green"
],
"products": [
{
"title": "Hat",
"price": 10
},
{
"title": "Tee",
"price": 25.5
},
{
"title": "Cap",
"price": 8
}
]
}liquid
{{ colors | sort | join: ', ' }}
{%- assign sorted = products | sort: 'price' %}
{{ sorted | map: 'title' | join: ', ' }}Output
html
Blue, green, red
Cap, Hat, Tee