Enhanced Pagination

SHOPIFY SNIPPET

1 Overview

Upgrade your Shopify pagination with numbered navigation that improves user experience and SEO. This snippet replaces basic "Previous/Next" links with a complete page number navigation system, helping customers easily browse through your product collections and blog articles.

2 Key Features

Numbered Navigation

Displays all available pages with current page highlighted

Visual Indicators

Current page clearly highlighted in your brand green (#87e64b)

SEO Optimized

Proper link structure helps search engines crawl your pages

Mobile Friendly

Responsive design works perfectly on all devices

3 Code Implementation

{% comment %}
  Page Numbers in Pagination
  Enhanced pagination with page numbers
  Provided by XeeZone - www.xeezone.com/free-shopify-code-snippets-by-xeezone
{% endcomment %}

{% if paginate.pages > 1 %}
  <div class="pagination">
    {% if paginate.previous %}
      <a href="{{ paginate.previous.url }}" class="prev">&laquo; Previous</a>
    {% endif %}
    
    {% for part in paginate.parts %}
      {% if part.is_link %}
        <a href="{{ part.url }}">{{ part.title }}</a>
      {% else %}
        <span class="current">{{ part.title }}</span>
      {% endif %}
    {% endfor %}
    
    {% if paginate.next %}
      <a href="{{ paginate.next.url }}" class="next">Next &raquo;</a>
    {% endif %}
  </div>
{% endif %}

<style>
  .pagination {
    text-align: center;
    margin: 30px 0;
  }
  .pagination a, .pagination span {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 5px;
    border: 1px solid #ddd;
  }
  .pagination .current {
    background: #87e64b;
    color: white;
    border-color: #87e64b;
  }
</style>

4 Installation Guide

1

Locate Pagination

Find your existing pagination code (usually in sections/collection-template.liquid or snippets/pagination.liquid)

2

Replace Existing Code

Remove the default pagination and replace it with this enhanced version

3

Customize Styling

Adjust the CSS in the style tag to match your store's design system

4

Test Functionality

Verify the pagination works correctly on collection pages with multiple pages

5

Implement Sitewide

Apply to blog pagination by updating templates/blog.liquid if needed

Pro Tip: For large collections, add {% if forloop.index <= 5 or forloop.index >= paginate.pages.size - 5 %} to limit visible page numbers and improve performance.

Scroll to Top