sort - Liquid Filter Reference - 1.0.0
Filter Name | sort |
Group | Arrays |
Version | 1.0.0 |
Description
Sorts items in an array in case-sensitive order.
Examples
{% assign an_array = "earth, Water, air, fire" | split: ", " %}
{{ an_array | sort | join: ", " }}
Water, air, earth, fire
An optional argument specifies which property of the array’s items to use for sorting:
{% assign pages_by_title = pages | sort: "title" %}
{% for page in pages_by_title -%}
- {{ page.title }}
{% endfor %}
- About Us
- Home
- Privacy Policy
Back to Liquid Reference for 1.0.0
Back to Documentation