Arrays

Working With Arrays

These filters help you in working with arrays.

File Load Failed. File "~~/Assets/Lava/LiquidDocFilters.lava" could not be accessed.

Array Filters In Action

Reading through the filters above you might question the value of many of them. For instance what good is the 'Map' filter when it just returns a string of array values all smashed together (Avalon CampusTacoma CampusCorolla Campus). The power comes when you chain these filters together. Consider the kitchen sink example below.

{% assign sortedCampuses = Campuses | Sort:'Name' %}
{{ sortedCampuses | Map:'Name' | Join:', ' | ReplaceLast:',',' and' }}

Output:
Avalon Campus, Corolla Campus and Tacoma Campus
Subscribe To Our Newsletter