Is it possible to list a blogs?
{% for blog in blogs %}
this is not working for me.
Is it possible to list a blogs?
{% for blog in blogs %}
this is not working for me.
I don’t see any reference in the Liquid docs to do this, maybe look at using the Storefront API which allows you to retrieve all the blogs.
The short answer is no. You can’t loop through the blogs.
But, there is a way to access blogs. A bit manual work but possible.
First create an array of blog handles.
{% assign blogsHandles = 'fashion,news,beauty,journal'| split: ',' %}
Now, you can loop through
{% for blogHandle in blogsHandles %}
{{ blogs[blogHandle].title }}
{% endfor %}
This should work.
If you want, you can create a theme settings for blogsHandles values and update it later from theme settings.
{% assign blogsHandles = settings.blog_handles | split: ',' %}
{% for article in blogs.potion-notions.articles %}
{{- article.title | link_to: article.url }}
{% endfor %}
You can loop like this.
Could be a good use case for a nav menu, that way you also can control the order of the blogs if you want to; the only downside is you’d need to manually add new blogs