【问题标题】:Shopify Liquid - Some tag filtered blogs not showingShopify Liquid - 一些标签过滤的博客未显示
【发布时间】:2020-07-15 08:35:54
【问题描述】:

我为客户网站上的一些页面创建了一个博客部分,这些页面通过液体代码进行标记和过滤。

{% 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 sn-p 是在网格中显示单个图块的代码:

<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个显示? 我是否缺少上面的过滤器由于某种原因跳过帖子的内容?

【问题讨论】:

    标签: shopify liquid


    【解决方案1】:

    对于其他正在寻找答案的人......我通过在 for 语句周围添加分页液体代码来修复它:

    {% paginate blogs.news.articles by 999 %}
     ....
    {% endpaginate %}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-20
      • 2020-10-21
      • 2015-12-10
      相关资源
      最近更新 更多