How can I loop through all pages in Shopify? I have tried this:
{% for page in pages %}
{{ page.title }} <br>
{% endfor %}
It doesn’t work.
How can I loop through all pages in Shopify? I have tried this:
{% for page in pages %}
{{ page.title }} <br>
{% endfor %}
It doesn’t work.
2
Answers
Apparently it is not possible to iterate over pages in liquid, but we can do it with JS:
You can iterate through up to 50 pages at a time with Liquid pagination:
https://shopify.dev/docs/themes/liquid/reference/objects#pages