液体语法错误(第 4 行):预期end_of_string,但在"forloop.index0 | modulo: 3 == 0"中找到管道



这个错误是由于下面用不正确的语法编写的代码。你能帮我修改一下这两行的语法错误吗?

{% if forloop.index0 | modulo: 3 == 0 %}<div class="row">{% endif %}
{% if forloop.last || forloop.index | modulo: 3 == 0 %}

<div class="impact-items">
{% for block in section.blocks %}
{% if forloop.index0 | modulo: 3 == 0 %}<div class="row">{% endif %}
<div class="impact-content col-xs-12 col-md-4">
<div class="impact-icon"><img src="{{block.settings.impact_icon | img_url: 'master' }}"></div>
<div>
<div class="impact-number">{{block.settings.impact_number}}</div>
<div class="impact-text">{{block.settings.impact_text}}</div>
</div>
</div>
{% if forloop.last || forloop.index | modulo: 3 == 0 %}
</div>
{% endif %}
{% endfor %}
<div class="row">
<div class="mt2x btn center-xs col-sm-12 col-md-12 col-lg-12 col-xl-12"><a href='https://packedwithpurpose.gifts/our-impact/impact-report-2020/'><button>Learn More About our Impact</button></a></div>
</div> 
</div>

您缺少结束If语句。{% endif %}

下面是没有错误的完整代码-

{% if forloop.index0 | modulo: 3 == 0 %}<div class="row">{% endif %}
{% if forloop.last || forloop.index | modulo: 3 == 0 %}
<div class="impact-items">
{% for block in section.blocks %}
{% if forloop.index0 | modulo: 3 == 0 %}<div class="row">{% endif %}
<div class="impact-content col-xs-12 col-md-4">
<div class="impact-icon"><img src="{{block.settings.impact_icon | img_url: 'master' }}"></div>
<div>
<div class="impact-number">{{block.settings.impact_number}}</div>
<div class="impact-text">{{block.settings.impact_text}}</div>
</div>
</div>
{% if forloop.last || forloop.index | modulo: 3 == 0 %}
</div>
{% endif %}
{% endfor %}
<div class="row">
<div class="mt2x btn center-xs col-sm-12 col-md-12 col-lg-12 col-xl-12"><a href='https://packedwithpurpose.gifts/our-impact/impact-report-2020/'><button>Learn More About our Impact</button></a></div>
</div> 
</div>
{% endif %}
{% if forloop.index0 | modulo: 3 == 0 %}<div class="row">{% endif %}
{% if forloop.last || forloop.index | modulo: 3 == 0 %}
<div class="impact-items">
{% for block in section.blocks %}
{% modulo = forloop.index0 | modulo: 3 %}
{% if modulo == 0 %}<div class="row">{% endif %}
<div class="impact-content col-xs-12 col-md-4">
<div class="impact-icon"><img src="{{block.settings.impact_icon | img_url: 'master' }}"></div>
<div>
<div class="impact-number">{{block.settings.impact_number}}</div>
<div class="impact-text">{{block.settings.impact_text}}</div>
</div>
</div>
{% if forloop.last || forloop.index | modulo: 3 == 0 %}
</div>
{% endif %}
{% endfor %}
<div class="row">
<div class="mt2x btn center-xs col-sm-12 col-md-12 col-lg-12 col-xl-12"><a href='https://packedwithpurpose.gifts/our-impact/impact-report-2020/'><button>Learn More About our Impact</button></a></div>
</div> 
</div>
{% endif %}

相关内容

  • 没有找到相关文章

最新更新