Creating a sitemap page with pagination / all records

Highlighted
New Member
10 0 0

Hello there,

I'm developing my own sitemap page in Shopify using Liquid. I have been able to pull the pages, collection (up to 50) and product (up to 50).

Due to Shopify's constraints of listing only 50 records, I need to understand if it's possible to pagination a page. I have well over 1,000 links (pages, collections, products, blogs) on our site, but with Shopify only limiting me to 50 on a page, other than creating an App I can't see any other way I can display more records on the page.

Please see my liquid code below:

<div class="parent-container">
        <h1>Pages:</h1>
        <div class="link-container">
          {% for link in linklists.sitemap-menu.links %}
          	<a class="sitemap_link" href="{{ link.url }}">{{ link.title }}</a><br>
          {% endfor %}
        </div>
    </div>
    <div class="parent-container">
        <h1>Collections:</h1>
        <div class="link-container">
          {% for product in collections %}
          {% if product.handle != 'all-products' %}
          <a class="sitemap_link" href="{{ product.url | within: collection }}">{{ product.title }}</a>&nbsp;
          {% endif %}
          {% endfor %}
        </div>
    </div>
    <div class="parent-container">
        <h1>Products:</h1>
        <div class="link-container">
          {% if collections.all-products.products.size > 0 %}
          	{% assign count = 0 %}
            {% for product in collections.all-products.products %}
          		{% assign count = count | plus: 1 %}
            	<a class="sitemap_link" href="{{ product.url }}">{{ count }} - {{ product.title | escape  }}</a><br>
            {% endfor %}
          {% endif %}
        </div>
    </div>

 Would someone please be able to assist me in getting this paginated, or explaining if it's even possible. I'm thinking I may need to go down the route of creating a custom App. I don't want to use paid-apps to keep costs low and reduce performance issues.

Thanks

Matt

0 Likes