Paginating Sorted Blog Posts

Highlighted
Shopify Partner
2 0 0

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