Developer changelog

Subscribe to the changelog to stay up to date on recent changes to Shopify’s APIs and other developer products, as well as preview upcoming features and beta releases.

Get updates by RSS

The Pages global Liquid object is now iterable

Themes

You can now iterate through the global Liquid Pages object, instead of only being able to directly reference known pages through their handle. This allows you to access a paginated pages listing of up to 50 items at a time and produce HTML that is conditional to the page data that is available.

{% comment %} 
    Before: Create a list of known pages in a store.  
{% endcomment %}

<ul>
    <li>{{pages.about.title}}</li>
    <li>{{pages.contact.title}}</li>
</ul>

{% comment %} 
    Now: Create a paginated list of pages that are present in a store. 
{% endcomment %}

<ul>
{%- paginate pages by 50 \-%}
    {%- for currentPage in pages -%}
        <li>{{currentPage.title}}</li>
    {%- endfor -%}
    {{ paginate | default\_pagination: next: 'Older', previous: 'Newer' }} 
{%- endpaginate \-%}
</ul>