paginate
The paginate
object provides information on paginate navigation, it contains following attributes:
Object Fields
Field | Data Type | Description |
---|---|---|
paginate.current_page | Number | Returns the number of the current page. |
paginate.current_offset | Number | Returns the number of items in previous pages. For example, if you are currently in page 5 and number of items per page is 12, current_offset will be 48 in this case. |
paginate.items | Number | Returns the number of items in total. |
paginate.page_size | Number | Returns the number of items in each page |
paginate.pages | Number | Returns the number of pages available. |
paginate.parts | Array | Returns an array of parts for pagination rendering. |
paginate.next | Object | Returns the Part object of next page |
paginate.previous | Object | Returns the Part object of previous page |
paginate.sort_options | Array | Returns an array of available sorting options. Each option contains attributes value and title |
paginate.limit_options | Array | Returns an array of suggested items per page options. Each option contains attributes value and title |
paginate.selected_sort_option | String | Returns current selected sort option object's value. e.g. created_at_asc |
Code Example
{% for part in paginate.parts %}
<li class="{% if part.page == paginate.current_page %}active{% endif %}">
<a href="{{ part.handle }}">
{{ part.title }}
</a>
</li>
{% endfor %}
Updated about 1 year ago