reverse - Liquid Filter Reference
On this page
Description
Reverses the order of the items in an list. reverse cannot reverse a string.
| Property | Value |
|---|---|
| Return Type | list |
| Category | lists |
Examples
liquid
{{ an_list | reverse | join: ", " }}
Output: fire, air, water, earth
Although reverse cannot be used directly on a string, you can split a string into an list, reverse the list, and rejoin it by chaining together filters
liquid
{{ "Mary had a little lamb." | split: "" | reverse | join: "" }}
Output: .bmal elttil a dah yraM