List - Liquid Variable Reference - 0.11.4
Variable Name | List |
Version | 0.11.4 |
Description
List objects are a special objects that contain one or more regular objects. In programming terms they are called arrays.
In the documentation you will see them defined like this: List[Image]
This means that this List contains one or more Image objects.
Accessing Items in a List
There are 2 ways to access an item in a List.
1. Array syntax
{{ list_of_images[3] }}
Note:
Lists are zero-based, meaning the first item is accessed with 0, the second with 1, etc.
2. Loop using for
tag
{% for image in list_of_images %}
...
{% endfor %}
Attributes
Lists have the following attributes:
Attribute | Type | Description |
---|---|---|
size | Number | Returns the number of items in this List |
first | Various | Returns the first item in the List |
last | Various | Returns the last item in the List |
Back to Liquid Reference for 0.11.4
Back to Documentation