reverse

Reverses the order of the items in an array. reverse cannot reverse a string (but you can split a string into an array, reverse the array and rejoin it by chaining together filters).

Input
  • {% assign my_array = "apples, oranges" | split: ', ' %}
    {{ my_array | reverse | join: ', '}}
Output
  • oranges, apples