Sort Natural
Sorts an array without regard to case, and orders numbers inside strings by their value. With a property name, the filter sorts the items by this property.
liquid
{{ array | sort_natural: property }}Example
Data
json
{
"tags": ["sale", "Accessories", "new"],
"sizes": [
{ "name": "Size 10" },
{ "name": "Size 2" }
]
}liquid
{{ tags | sort_natural | join: ', ' }}
{{ sizes | sort_natural: 'name' | map: 'name' | join: ', ' }}Output
html
Accessories, new, sale
Size 2, Size 10