PaginatedList - Liquid Variable
On this page
Description
A PaginatedList represents a server-side paginated collection of items. Unlike a regular List, records are fetched on-demand per page rather than loading all at once. Use the {% paginate %} tag to control page size and navigation.
| Property | Value |
|---|---|
| Type | PaginatedList |
| String Representation | PaginatedList[ContentType] |
| Index Access | No (returns nil) |
| Key Lookup | Yes (list["key"]) |
Attributes
| Attribute | Type | Description |
|---|---|---|
any? |
Boolean | Returns true if the PaginatedList contains at least one item |
first |
Object | Returns the first item in the PaginatedList |
last |
Object | Returns the last item in the PaginatedList |
size |
Number | Returns the number of items in the PaginatedList |
[] |
Object | Access items by key lookup (e.g. list["slug"]). Integer index access returns nil for paginated collections |
each |
Iterator | Iterate over items on the current page using a {% for %} loop |
Examples
Paginating a PaginatedList
```liquid {% paginate collection.products by 12 %} {% for product in collection.products %} <p>{{ product.name }}</p> {% endfor %}
{{ paginate | default_pagination }} {% endpaginate %} ```
Accessing by key
liquid
{{ pages["about-us"].name }}
Checking if the list has items
liquid
{% if collection.products.any? %}
{{ collection.products.size }} products found
{% endif %}