0
我想要完成的是当用户在单独的博客文章/文章中,我想根据匹配标签显示独特的“相关文章”。Shopify - 根据当前文章的标签获取独特的文章
这是我到目前为止有:
{% for tag in article.tags %}
{% assign counter = 0 %}
{% for article in blog.articles %}
{% if article.tags contains tag and counter < 2 %}
{% assign counter = counter | plus: 1 %}
<li class="well">
{% if article.excerpt.size > 0 %}
<div class="thumb-article">
<a href="{{ article.url }}">
{{ article.excerpt }}
</a>
</div>
{% endif %}
<h3><a href="{{ article.url }}">{{ article.title }}</a></h3>
<p>{{ article.content | strip_html | strip_newlines | truncatewords: 40 }}</p>
</li>
{% endif %}
{% endfor %}
{% endfor %}
出人意料的是,(对我来说,因为这是我与Shopify和液体第一次的经验)它的工作原理,只是有点太清楚,因为它得到重复的帖子。
有没有什么方法可以防止它获得重复的文章?
您的链接已锁定密码,因此我们无法看到它。 –
此代码可以帮助您吗? http://stackoverflow.com/questions/30042090/shopify-liquid-get-related-blog-posts –
或者这个:https://apps.shopify.com/related-blog-posts –