Reputation: 39
I have a Shopify blog, in this example called blog1. I would like to use liquid to access all articles within that blog, whilst filtering by a specific tag.
For instance, supposing I am at the following URL (i.e. tagging by articles with the tag "chicken").
www.website.com/blogs/blog1/tagged/chicken
When I do {% for article in blog.articles %}{{ article.title }}{% endfor %}
, it only outputs articles which have the tag "chicken". I understand that this is normal and expected behaviour for filtering, but I want to know how I can still somehow loop through all articles from this page.
I have looked at Shopify: blog.articles doesn't show all articles when in tagged view but their question is slightly different, and the only answer is not a valid solution in this case: {% for article in blog['blog1'].articles %}{{article.url}}{%endfor%}
does not work.
Upvotes: 0
Views: 1532
Reputation: 12943
You need to refer to the global blogs
object and the specific handle of the blog.
So the answer you showed is correct but your implementation is not. The global blogs object is written like so blogs['handle']
and not blog['handle']
.
So in your case it will be like so:
{% for article in blogs['blog1'].articles %}
{{article.url}}
{% endfor %}
Just add the missing s
in the blog object.
Upvotes: 1