sort - Liquid Filter Reference - 0.11.4
Filter Name | sort |
Group | Arrays |
Version | 0.11.4 |
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 0.11.4
Back to Documentation