Paginate articles from all blogs

Steffo
New Member
2 0 0

Can I somehow paginate all articles from all different blogs, sorted by date created?

I've tried this, which doesn't work. Any other ideas?

{% assign featuredBlogs = "All,Products,Health,Training,Nutrition" | split: "," %}
      {% assign featuredArticles = false %}
        {% for featuredBlog in featuredBlogs %}
          {% if blogs[featuredBlog].articles %}
    {% if featuredArticles %}
  {% assign featuredArticles = featuredArticles | concat:blogs[featuredBlog].articles %}
    {% else %}
  {% assign featuredArticles = blogs[featuredBlog].articles %}
    {% endif %}
      {% endif %}
        {% endfor %}
        
        {% if featuredArticles %}
          {% assign featuredArticles = featuredArticles | sort:'published_at' | reverse %}
              {% paginate featuredArticles by 5 %}
                {% for article in featuredArticles %}
                   .....Display articles.....
                {% endfor %}
                {% include "pagination" %}
              {% endpaginate %}
            </div>
          </div>
        {% endif %}
0 Likes