[英]How to Filter all Blog.Articles by containing specific tag in Shopify?
hello is there anyone shopify experts out there .你好,有没有shopify专家在那里。 my only goal is to filter or display all articles according to their tag .
我唯一的目标是根据标签过滤或显示所有文章。
so this is what i have so far from this forum所以这就是我到目前为止从这个论坛所拥有的
{% assign counter = 0 %}
{% for article in blogs['lookbook'].articles %}
{% if article.tags contains 'Fox Racing' and counter < 2 %}
{% assign counter = counter | plus: 1 %}
<div class="njohn_search_otherpage">
<a href="{{ article.url }}" title="{{ article.title | escape }}">
<div>{{ article.image.src | img_url: 'medium' | img_tag: article.title }}</div>
<div>{{ article.title }}</div>
</a>
</div>
{% endif %}
{% endfor %}
the code are working but it's only four article will showed up.代码正在运行,但只会显示四篇文章。 but in that sample tag i have already 10 articles.
但在那个示例标签中,我已经有 10 篇文章了。
The above code has a counter that limits the articles displayed, removing that counter works as expected, filtering all the articles by a tag.上面的代码有一个计数器来限制显示的文章,删除该计数器按预期工作,通过标签过滤所有文章。
{% for article in blogs['lookbook'].articles %}
{% if article.tags contains 'Fox Racing' %}
<div class="njohn_search_otherpage"> <a href="{{ article.url }}" title="{{ article.title | escape }}"> <div>{{ article.image.src | img_url: 'medium' | img_tag: article.title }}</div> <div>{{ article.title }}</div> </a> </div>
{% endif %}
{% endfor %}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.