Shopify If语句循环

时间:2020-02-23 21:22:32

标签: loops if-statement shopify

所以我试图仅模糊包含某些标签的图像,我能够做到,但是它模糊了包括文本在内的所有内容。我可以看到保留图像的位置,但在那里应用代码似乎没有效果。

<ul class="grid grid--uniform grid--view-items">
{% for product in collection.products limit: product_limit %}
  <li class="grid__item grid__item--{{section.id}} {{ grid_item_width }} ">



    {% include 'product-card-grid', max_height: max_height %}

  </li>
{% else %}

  {% for i in (1..product_limit) %}
    <li class=" grid__item grid__item--{{section.id}} {{ grid_item_width }} ">
      <div class=" grid-view-item product-card">
        <a class=" grid-view-item__link grid-view-item__image-container full-width-link " href="#">
          <span class="visually-hidden">{{ 'homepage.onboarding.product_title' | t }}</span>
        </a> 
        <div class="grid-view-item__image-wrapper"> <!-- this only effects the image on the homepage-->
          {% capture current %}{% cycle 1, 2, 3, 4, 5, 6 %}{% endcapture %}
          {{ 'product-' | append: current | placeholder_svg_tag: 'placeholder-svg' }}
        </div>
        <div class="h4 grid-view-item__title" aria-hidden="true">{{ 'homepage.onboarding.product_title' | t }}</div>
        {% include 'product-price', variant: nil %}
      </div>
    </li>
  {% endfor %}
{% endfor %}

实际模糊的代码段是

{% if product.tags contains "Lewd" or product.tags contains "lewd" %}blur{% endif %}

如果应用在li开头标签中,则会模糊包括文本在内的整个项目。

<div class="product-card__image-with-placeholder-wrapper" data-image-with-placeholder-wrapper="">

上面的代码似乎只是图像所在的位置,但是如果将模糊代码放在类中的上方,则似乎没有任何影响。

关于它可能在什么地方或为什么不生效的任何建议?抱歉,如果这有点开放,我已经对此颇为困惑。

0 个答案:

没有答案
相关问题