【发布时间】: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个显示? 我是否缺少上面的过滤器由于某种原因跳过帖子的内容?
【问题讨论】: