v1.9.1
Returns the first item of an array.
Input
1 | {{ "Ground control to Major Tom." | split: " " | first }} |
Output
1 | Ground |
Input
1 | {% assign my_array = "zebra, octopus, giraffe, tiger" | split: ", " %} |
Output
1 |
|
You can use first with dot notation when you need to use the filter inside a tag:
1 | {% if my_array.first == "zebra" %} |