[英]Shopify Liquid - Some tag filtered blogs not showing
I've created a blog section for some pages on a client site which are tagged and filtered via the liquid code.我为客户网站上的某些页面创建了一个博客部分,这些页面通过液体代码进行标记和过滤。
{% for article in blogs.news.articles %}
{% if template == "page.mountain-biking" %}
{% if article.tags contains 'biking' %}
{% include 'blog-grid-snippet' %}
{% endif %}
{% endif %}
{% endfor %}
There are elsif statements for different pages which filter by different tags.有针对不同页面的 elsif 语句,它们按不同的标签进行过滤。 blog-grid snippet is the code to display individual tiles in a grid:
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>
On one page it shows all the tagged articles correctly, but on the other three it misses 2 or 3 articles for no apparent reason.在一页上,它正确显示了所有标记的文章,但在另外三页上,它无缘无故地漏掉了 2 或 3 篇文章。 Swimming posts have 8 tagged, but only 5 show?
游泳帖子有8个标签,但只有5个显示? Am i missing something with the filter above that is skipping posts for some reason?
我是否缺少上面的过滤器由于某种原因跳过帖子的内容?
For anyone else looking for an answer to this... I fixed it by adding the paginate liquid code around the for statement:对于其他正在寻找答案的人......我通过在 for 语句周围添加分页液体代码来修复它:
{% paginate blogs.news.articles by 999 %}
....
{% endpaginate %}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.