简体   繁体   English

如何通过在 Shopify 中包含特定标签来过滤所有 Blog.Articles?

[英]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.

相关问题 在created.at排序的blog.articles数组中的正确位置插入重新发布的文章 - insert reblogged articles in the right place in blog.articles array ordered by created_at 如何在Rails上显示在ruby标签下发布的所有文章 - how to display all articles published under a tag in ruby on rails Rails:如何过滤具有特定参数的所有对象? - Rails: How filter all objects with specific parameter? 如何列出与某个类别相关的所有文章? - How to list all the articles related to a certain category? 如何在mongodb中获取带有注释的所有文章? - How to grab all articles with comments in mongodb? 非常基本博客 - 如何设置实例变量到特定日期的所有帖子从rails中的datetime属性? - Very Basic Blog - how to set an instance variable to all the posts from a specific date from a datetime attribute in rails? 发布文章时如何创建到DATE的链接,并列出发布在同一DATE的所有文章 - How to create a link to the DATE when ARTICLES were posted, and list all the articles posted on the same DATE 如何将所有shopify过滤器添加到标准液体中 - How to add all the shopify filters to standard liquid 如何在 Rails 中获取博客中的所有消息 - How to get all messages from a blog in Rails 在rails中查找包含特定属性的所有记录 - Finding all records containing a specific attribute in rails
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM