Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

This course is the most refreshing take on teaching design that I've come across.

— Mikaël Sévigny, Developer

sort Modifier

Sort an array by key as parameter 1 and direction (asc/desc) as parameter 2. If sorting a primitive list no parameters are necessary.

primitive:
- Zebra
- Alpha
- Bravo
complex:
-
last_name: Zebra
first_name: Zealous
-
last_name: Alpha
first_name: Altruistic
-
last_name: Bravo
first_name: Blathering
{{ primitive | sort | list }}
 
{{ complex | sort('last_name') }}
Hello, {{ first_name }} {{ last_name }}
{{ /complex }}
 
{{ complex | sort('last_name', 'desc') }}
Hello, {{ first_name }} {{ last_name }}
{{ /complex }}
Alpha, Bravo, Zebra
 
Hello, Altruistic Alpha
Hello, Blathering Bravo
Hello, Zealous Zebra
 
Hello, Zealous Zebra
Hello, Blathering Bravo
Hello, Altruistic Alpha
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →