How can I retrieve all pages from a Shopify shop using liquid template?

i_stelmakov
Visitor
2 0 6

Hi, how can I get all pages from shopify shop in liquid template 

This code doesn't work

{% for page in pages %}
<a href="{{ page.url }}">{{ page.title }}</a>
{% endfor %}

I can't use this variant:

{% for link in linklists.some-handle %}
  {% if link.object.description.size < 900 %}
    {{ link.object.title }}
  {% endif %}
{% endfor %}

because the solution has to be universal 

Replies 3 (3)

Jason
Shopify Expert
11190 225 2283

You need to use the linklists method as you can't iterate of the pages object. You could look into using AJAX with the storefront search results but that would have limited use cases.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
i_stelmakov
Visitor
2 0 6

But that's ridiculous, why nobody cares about such a simple issue. 

johnny_n
Tourist
4 0 0

For the record, this is now possible.  The first example given above now works.

 


{% for page in pages %}
<a href="{{ page.url }}">{{ page.title }}</a>
{% endfor %}