Paginating Sorted Blog Posts

kevmor
Shopify Partner
4 0 2

I am trying to get all Blog Posts and sort by date published which I have accomplished with this.

 

 

      {% assign allBlogs = 'recipes,health-and-wellness,impact-and-identity,culture' | split:',' %}
      {% assign newestArticles = false %}
      {% for blog in allBlogs %}
        {% if blogs[blog].articles %}
          {% if newestArticles %}
            {% assign newestArticles = newestArticles | concat:blogs[blog].articles %}
          {% else %}
            {% assign newestArticles = blogs[blog].articles %}
          {% endif %}
        {% endif %}
      {% endfor %}
      {% if newestArticles %}
        {% assign newestArticles = newestArticles | sort:'published_at' | reverse %}
      {% endif %}

I would then like to loop through these sorted articles and paginate them so as to create an archive of all blog posts.

Shopify doesn't allow me to paginate these sorted articles and based off what I found in other threads I may be better off using AJAX and JS to do the sorting rather than Liquid.

Please let me know if you have any other insights or recommendations on this.

Thanks,

Kevin

 

 

 

0 Likes
jao
Excursionist
17 0 1

Did you ever figure out a way to do this? I asked everywhere, even Shopify support but they refuse to help

0 Likes
kevmor
Shopify Partner
4 0 2

No, paginating all blog posts does not seem to be possible