sort Filter

Sorts an array alphabetically by a given attribute’s values for each element.

Parameters

Parameter Required Description
attribute Yes string Attribute whose values the array should be sorted by.

Category

Array Filters

Description

The sort filter sorts an array by a given attribute. The order of the sorted array is case-sensitive: capital letters are sorted before lowercase letters.

{% assign sorted_links = navigation.links | sort: 'title' %}