Shopify Liquid-一些标签过滤的博客未显示

时间:2020-07-15 08:35:54

标签: shopify liquid

我为客户站点上的某些页面创建了博客部分,这些页面通过即时代码进行了标记和过滤。

{% for article in blogs.news.articles %}
        {% if template == "page.mountain-biking" %}
{% if article.tags contains 'biking' %}
{% include 'blog-grid-snippet' %}
{% endif %}
        {% endif %}
      {% endfor %} 

对于不同的页面有elsif语句,它们通过不同的标签进行过滤。 blog-grid片段是用于在网格中显示单个图块的代码:

<div class="grid__item {{ blog_item_width  }}">
        <div class="article">
          <div class="blog-description">
            <div class="page-blog-content blog-detail" style="background-image:url({{ article | img_url: 'master' }});background-position: center;
    background-size: cover;">
              <a href="{{ article.url }}">
                <div class="button-text">
              <h4>{{ article.title }}</h4>
              <p>Read More ></p>
                </div>
             </a>
            </div>
          </div>
        </div>
      </div>

在一页上,它正确显示了所有带标签的文章,但在另外三页上,没有明显的原因错过了2或3篇文章。 游泳馆有8个标签,但只有5个显示? 我在上面的过滤器中缺少某些出于某种原因而跳过帖子的内容吗?

1 个答案:

答案 0 :(得分:1)

对于寻求此答案的其他任何人……我通过在for语句周围添加分页的液态代码来解决它:

{% paginate blogs.news.articles by 999 %}
 ....
{% endpaginate %}
相关问题