Shopify liquid模板:只重复一次HTML代码

Shopify liquid模板:只重复一次HTML代码,shopify,liquid,liquid-layout,Shopify,Liquid,Liquid Layout,我可以成功地在我的Shopify模板中添加第二个硬编码的商店地址。现在,我正在尝试添加第二个地址 我面临的挑战是,由于绑定settings.json文件中的值的for循环,这个硬编码地址正在重复 硬编码地址被重复三次,因为for循环正在考虑它。但是不能删除for循环,因为它绑定了第一个地址、联系人和访问时间 我试着用我的硬代码使用if块,但没有成功 这是我的密码: <div class="container main content main-wrapper"> {% if se

我可以成功地在我的Shopify模板中添加第二个硬编码的
商店地址
。现在,我正在尝试添加第二个
地址

我面临的挑战是,由于绑定
settings.json
文件中的值的
for
循环,这个硬编码地址正在重复

硬编码地址被重复三次,因为for循环正在考虑它。但是不能删除
for
循环,因为它绑定了第一个地址、联系人和访问时间

我试着用我的硬代码使用
if
块,但没有成功

这是我的密码:

<div class="container main content main-wrapper">
  {% if section.settings.image == nil %}
    <h1 class="center">{{ page.title }}</h1>
    <div class="feature_divider"></div>
  {% endif %}

  <div class="sixteen columns featured_links">
    <div class="section clearfix feature">
      {% for block in section.blocks %}
        <div class="{% if section.settings.featured_promos_per_row == 2 %}eight columns {% cycle 'alpha', 'omega' %}{% elsif section.settings.featured_promos_per_row == 3 %}one-third column {% cycle 'alpha', '', 'omega' %}{% else %}four columns {% cycle 'alpha', '', '', 'omega' %}{% endif %} {% if section.settings.featured_links_style != blank %}{{ section.settings.featured_links_style }} {% cycle 'delay-025s', 'delay-05s', 'delay-075s', 'delay-1s' %}{% endif %} center">
          {% if block.settings.link != blank %}
            <a href="{{ block.settings.link }}">
          {% endif %}

          <div class="{% if section.settings.rounded_image != blank %}rounded{% endif %}">
            {% if block.settings.image != nil %}
              <img  src="{{ block.settings.image | img_url: '300x' }}"
                    alt="{{ block.settings.image.alt }}"
                    data-src="{{ block.settings.image | img_url: '2048x' }}"
                    class="lazyload"
                    {% comment %} data-sizes="auto" {% endcomment %}
                    data-srcset=" {{ block.settings.image | img_url: '2048x' }} 2048w,
                                  {{ block.settings.image | img_url: '1600x' }} 1600w,
                                  {{ block.settings.image | img_url: '1200x' }} 1200w,
                                  {{ block.settings.image | img_url: '1000x' }} 1000w,
                                  {{ block.settings.image | img_url: '800x' }} 800w,
                                  {{ block.settings.image | img_url: '600x' }} 600w,
                                  {{ block.settings.image | img_url: '400x' }} 400w"
                     />
            {% else %}
              {% capture i %}{% cycle "1", "2", "3", "4", "5", "6" %}{% endcapture %}
              {{ 'collection-' | append: i | placeholder_svg_tag: 'placeholder-svg placeholder-svg--promotions' }}
            {% endif %}
          </div>

          {% if block.settings.title != blank %}
            <h3>{{ block.settings.title | escape }}</h3>
            {% if section.settings.show_divider %}
              <div class="feature_divider"></div>
            {% endif %}
          {% endif %}
          {% if block.settings.link != blank %}
            </a>
          {% endif %}

          {% if block.settings.text != blank %}
            {{ block.settings.text }}
          {% endif %}

        {% if section.blocks===1%}
        <div class="store-new">
          <br><p>XYZ</p><p>XYZ,<br>XYZ<br>XYZ</p>
        </div>
         {% endif %}        

        </div>

        {% if section.settings.featured_promos_per_row == 2 %}
          {% cycle '', '<br class="clear " />' %}
        {% elsif section.settings.featured_promos_per_row == 3 %}
          {% cycle '', '', '<br class="clear" />' %}
        {% else %}
          {% cycle '', '', '', '<br class="clear" />' %}
        {% endif %}
      {% endfor %}
    </div>

    {% if section.settings.contact_address != blank %}
    <br class="clear" />
    <div class="embed-container maps">
        <iframe width="100%" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q={{ section.settings.contact_address | replace: ' ', '+' }}&amp;z={{ section.settings.zoom_level }}&amp;output=embed"></iframe>
    </div>
    {% endif %}
  </div>


</div>

{%if section.settings.image==nil%}
{{page.title}}
{%endif%}
{section.blocks%中的块的%s}
{%if block.settings.link!=空白%}
{%endif%}
{%if block.settings.text!=空白%}
{{block.settings.text}
{%endif%}
{%if section.blocks==1%}

XYZXYZ,
XYZ
XYZ

{%endif%} {%if section.settings.featured_promos_per_row==2%} {%cycle'','
'%} {%elsif section.settings.featured_promos_per_row==3%} {%cycle'','',
'%} {%else%} {%cycle'','','
'%} {%endif%} {%endfor%} {%if section.settings.contact_address!=空白%}
有人能帮我理解为什么会这样吗?

你可以用

{{ if forloop.index0 == 1 }}

而不是

{% if section.blocks===1%}
你可以用

{{ if forloop.index0 == 1 }}

而不是

{% if section.blocks===1%}