sort_natural

Sorts items in an array by a property of an item in the array.

Input
  • {% assign my_array = "zebra, octopus, giraffe, Sally Snake" | split: ', ' %}
    {{ my_array | sort_natural | join: ', ' }}
Output
  • giraffe, octopus, Sally Snake, zebra