Skip to main content

part

A part in the navigation for pagination.

Properties

Returns true if the part is a link. Returns false if not.

The page number associated with the part.

The URL of the part.

It consists of the current page URL path with the pagination parameter for the current part appended.

{
"is_link": true,
"title": "2",
"url": "/collections/all?page=2&phcursor=eyJhbGciOiJIUzI1NiJ9.eyJzayI6InBvc2l0aW9uIiwic3YiOjIwLCJkIjoiZiIsInVpZCI6MzY5MTI0Nzk3NjQ2NTksImwiOjIwLCJvIjowLCJyIjoiQ0RQIiwidiI6MSwicCI6Mn0.rlQnBhrVp_ZXLZBZRzrYxxDDKfpaPSH2UmkttMttC0s"
}
Anchor to Create pagination navigation with `part`

Create pagination navigation with part

You can create a pagination navigation by iterating over each part of a paginate object. When paginating, part.url may contain a phcursor parameter in addition to page. This optional parameter is used to improve performance when navigating between pages.

{% paginate collection.products by 5 -%}
{% for part in paginate.parts -%}
{% if part.is_link -%}
{{ part.title | link_to: part.url}}
{%- else -%}
<span>{{ part.title }}</span>
{% endif %}
{%- endfor %}
{%- endpaginate %}

Output

<span>1</span>
<a href="/services/liquid_rendering/resource?page=2" title="">2</a>

<a href="/services/liquid_rendering/resource?page=3" title="">3</a>

<a href="/services/liquid_rendering/resource?page=4" title="">4</a>
Was this section helpful?