map Filter
Grabs a given attribute’s value from each element in an array and combines it all into a new array.
Parameters
| Parameter | Required | Description |
|---|---|---|
attribute
|
Yes |
string Attribute by name whose values will be collected into the new array.
|
Category
Description
The map filter grabs an attribute’s value from each element within an array and
combines it into a new array.
{% comment %}
Our sample array to work with is a list of navigation link
titles.
{% endcomment %}
{% assign links = navigation.links | map: 'title' %}
{{ links | join }}
{{ links | join: ', ' }}
Example Output
HomeProductsAbout UsContact Us
Home, Products, About Us, Contact Us