[![在此输入图片说明] [1]] [1]我的工作太简单了,只是在产品thumbnail.liquid中的div块中添加亚马逊网址。我添加了简单的div,然后我发现相同的div重复两次。我还检查了发现没有forloop
仍然是如何重复的。今天我发现名为product-loop.liquid
的文件包含for
循环和product thumbnail.liquid
。如果我只需要显示一次亚马逊链接块,我需要做什么?整个文件都在gist link.Thanks。
产品loop.liquid
{% assign product_found = false %}
{% assign skip = false %}
{% assign collection_group = products | map: 'id' %}
{% assign collection_group_thumb = collection_group | append : 'thumb' %}
{% assign collection_group_mobile = collection_group | append : 'mobile' %}
{% capture new_row %}
<br class="clear product_clear" />
{% endcapture %}
<div itemtype="http://schema.org/ItemList" class="products">
{% for product in products limit: limit %}
{% if product.id == skip_product.id or skip == true %}
{% assign product_found = true %}
{% else %}
{% if forloop.rindex0 == 0 and product_found == false and forloop.length != products.count and template != 'search' %}
{% assign skip = true %}
{% else %}
{% include 'product-thumbnail', sidebar: sidebar %}
{% if products_per_row == 2 %}
{% cycle collection_group: '', new_row %}
{% elsif products_per_row == 3 %}
{% cycle collection_group: '', '', new_row %}
{% elsif products_per_row == 4 %}
{% cycle collection_group: '', '', '', new_row %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
</div>
答案 0 :(得分:1)
可能是您在一个部分中包含product.thumbnail,该部分包含循环或条件逻辑。