Is there a way to list all blogs? For example:
<ul>
{% for blog in blogs %}
<li>{{ blog.title }}</li>
{% endfor %}
</ul>
Thanks!
Is there a way to list all blogs? For example:
<ul>
{% for blog in blogs %}
<li>{{ blog.title }}</li>
{% endfor %}
</ul>
Thanks!
Hi @Atique ,
Is this one category only? cause I have 14 subcategories and I want to show it on the homepage but I do not know how to put that in one section all categories on the homepage of my website
{% assign cats = "top-stories,news,entertainment,whaterver-your-blog-is-called" | split: ',' %}
{% for cat in cats %}
{% for article in blogs[cat].articles %}
{{ article.title }}
{% endfor %}
{% endfor %}
What if you want to sort by newest first? that does not work.
You could try:
{% assign blog_posts_reversed = blogs[cat].articles | reverse %}
{% for article in blog_posts_reversed}
I haven’t tested this. However, I use this in my template–blog.liquid page to list the blogs in ascending order:
{% assign blog_posts_sorted = blog.articles | reverse %}
{% for article in blog_posts_sorted %}