default_ pagination
paginate | default_pagination
returns string
Generates HTML for a set of links for paginated results. Must be applied to the paginate
object.
{% paginate collection.products by 2 %}
{% for product in collection.products %}
{{- product.title }}
{% endfor %}
{{- paginate | default_pagination -}}
{% endpaginate %}
{% paginate collection.products by 2 %}
{% for product in collection.products %}
{{- product.title }}
{% endfor %}
{{- paginate | default_pagination -}}
{% endpaginate %}
{
"collection": {
"products": [
{
"title": "Draught of Immortality"
},
{
"title": "Glacier ice"
}
],
"products_count": 4
}
}
Output
Draught of Immortality
Glacier ice
<span class="page current">1</span> <span class="page"><a href="/services/liquid_rendering/resource?page=2&phcursor=eyJhbGciOiJIUzI1NiJ9.eyJzayI6InByb2R1Y3RfdGl0bGUiLCJzdiI6IkdsYWNpZXIgaWNlIiwiZCI6ImYiLCJ1aWQiOjI5NTA0ODMzNDU0MTQ1LCJsIjoyLCJvIjowLCJyIjoiQ0RQIiwidiI6MSwicCI6Mn0.Bhqmziu3Mmoc8JQr-060L9sqOFdFJoSn-sF8uAzQUyU" title="">2</a></span> <span class="next"><a href="/services/liquid_rendering/resource?page=2&phcursor=eyJhbGciOiJIUzI1NiJ9.eyJzayI6InByb2R1Y3RfdGl0bGUiLCJzdiI6IkdsYWNpZXIgaWNlIiwiZCI6ImYiLCJ1aWQiOjI5NTA0ODMzNDU0MTQ1LCJsIjoyLCJvIjowLCJyIjoiQ0RQIiwidiI6MSwicCI6Mn0.Bhqmziu3Mmoc8JQr-060L9sqOFdFJoSn-sF8uAzQUyU" title="">Next »</a></span>
Anchor to previous
previous
paginate | default_pagination: previous: string
Specify the text for the previous page link.
{% paginate collection.products by 2 %}
{% for product in collection.products %}
{{- product.title }}
{% endfor %}
{{- paginate | default_pagination: previous: 'Previous' -}}
{% endpaginate %}
{% paginate collection.products by 2 %}
{% for product in collection.products %}
{{- product.title }}
{% endfor %}
{{- paginate | default_pagination: previous: 'Previous' -}}
{% endpaginate %}
{
"collection": {
"products": [
{
"title": "Draught of Immortality"
},
{
"title": "Glacier ice"
}
],
"products_count": 4
}
}
Output
Draught of Immortality
Glacier ice
<span class="page current">1</span> <span class="page"><a href="/services/liquid_rendering/resource?page=2&phcursor=eyJhbGciOiJIUzI1NiJ9.eyJzayI6InByb2R1Y3RfdGl0bGUiLCJzdiI6IkdsYWNpZXIgaWNlIiwiZCI6ImYiLCJ1aWQiOjI5NTA0ODMzNDU0MTQ1LCJsIjoyLCJvIjowLCJyIjoiQ0RQIiwidiI6MSwicCI6Mn0.Bhqmziu3Mmoc8JQr-060L9sqOFdFJoSn-sF8uAzQUyU" title="">2</a></span> <span class="next"><a href="/services/liquid_rendering/resource?page=2&phcursor=eyJhbGciOiJIUzI1NiJ9.eyJzayI6InByb2R1Y3RfdGl0bGUiLCJzdiI6IkdsYWNpZXIgaWNlIiwiZCI6ImYiLCJ1aWQiOjI5NTA0ODMzNDU0MTQ1LCJsIjoyLCJvIjowLCJyIjoiQ0RQIiwidiI6MSwicCI6Mn0.Bhqmziu3Mmoc8JQr-060L9sqOFdFJoSn-sF8uAzQUyU" title="">Next »</a></span>
Anchor to next
next
paginate | default_pagination: next: string
Specify the text for the next page link.
{% paginate collection.products by 2 %}
{% for product in collection.products %}
{{- product.title }}
{% endfor %}
{{- paginate | default_pagination: next: 'Next' -}}
{% endpaginate %}
{% paginate collection.products by 2 %}
{% for product in collection.products %}
{{- product.title }}
{% endfor %}
{{- paginate | default_pagination: next: 'Next' -}}
{% endpaginate %}
{
"collection": {
"products": [
{
"title": "Draught of Immortality"
},
{
"title": "Glacier ice"
}
],
"products_count": 4
}
}
Output
Draught of Immortality
Glacier ice
<span class="page current">1</span> <span class="page"><a href="/services/liquid_rendering/resource?page=2&phcursor=eyJhbGciOiJIUzI1NiJ9.eyJzayI6InByb2R1Y3RfdGl0bGUiLCJzdiI6IkdsYWNpZXIgaWNlIiwiZCI6ImYiLCJ1aWQiOjI5NTA0ODMzNDU0MTQ1LCJsIjoyLCJvIjowLCJyIjoiQ0RQIiwidiI6MSwicCI6Mn0.Bhqmziu3Mmoc8JQr-060L9sqOFdFJoSn-sF8uAzQUyU" title="">2</a></span> <span class="next"><a href="/services/liquid_rendering/resource?page=2&phcursor=eyJhbGciOiJIUzI1NiJ9.eyJzayI6InByb2R1Y3RfdGl0bGUiLCJzdiI6IkdsYWNpZXIgaWNlIiwiZCI6ImYiLCJ1aWQiOjI5NTA0ODMzNDU0MTQ1LCJsIjoyLCJvIjowLCJyIjoiQ0RQIiwidiI6MSwicCI6Mn0.Bhqmziu3Mmoc8JQr-060L9sqOFdFJoSn-sF8uAzQUyU" title="">Next</a></span>
Anchor to anchor
anchor
paginate | default_pagination: anchor: string
Specify the anchor to add to the pagination links.
{% paginate collection.products by 2 %}
{% for product in collection.products %}
{{- product.title }}
{% endfor %}
<div id="pagination">
{{- paginate | default_pagination: anchor: 'pagination' -}}
</div>
{% endpaginate %}
{% paginate collection.products by 2 %}
{% for product in collection.products %}
{{- product.title }}
{% endfor %}
<div id="pagination">
{{- paginate | default_pagination: anchor: 'pagination' -}}
</div>
{% endpaginate %}
{
"collection": {
"products": [
{
"title": "Draught of Immortality"
},
{
"title": "Glacier ice"
}
],
"products_count": 4
}
}
Output
Draught of Immortality
Glacier ice
<div id="pagination"><span class="page current">1</span> <span class="page"><a href="/services/liquid_rendering/resource?page=2&phcursor=eyJhbGciOiJIUzI1NiJ9.eyJzayI6InByb2R1Y3RfdGl0bGUiLCJzdiI6IkdsYWNpZXIgaWNlIiwiZCI6ImYiLCJ1aWQiOjI5NTA0ODMzNDU0MTQ1LCJsIjoyLCJvIjowLCJyIjoiQ0RQIiwidiI6MSwicCI6Mn0.Bhqmziu3Mmoc8JQr-060L9sqOFdFJoSn-sF8uAzQUyU#pagination" title="">2</a></span> <span class="next"><a href="/services/liquid_rendering/resource?page=2&phcursor=eyJhbGciOiJIUzI1NiJ9.eyJzayI6InByb2R1Y3RfdGl0bGUiLCJzdiI6IkdsYWNpZXIgaWNlIiwiZCI6ImYiLCJ1aWQiOjI5NTA0ODMzNDU0MTQ1LCJsIjoyLCJvIjowLCJyIjoiQ0RQIiwidiI6MSwicCI6Mn0.Bhqmziu3Mmoc8JQr-060L9sqOFdFJoSn-sF8uAzQUyU#pagination" title="">Next »</a></span></div>
Was this page helpful?