【问题标题】:How to use blocks and if statement in statamic如何在 statamic 中使用块和 if 语句
【发布时间】:2018-02-22 08:30:02
【问题描述】:

我正在尝试使用带有 if 语句的块 但是当我使用 {{ if }} 条件时,它之外的所有内容都会显示双重内容

示例:

{{ blocks }}
... more code and 2 more IFs above
  {{ if set == "hero-1" }}
<div class="container ">
    <section class="hero">
        <div class="hero-body">
            <div class="padding-50 has-text-centered">
                <h1 class="h1">
                    Heading
                </h1>
                <h2 class="h2">
                    Heading 2
                </h2>
            </div>
        </div>
    </section>
</div>
  {{ /if }}
<hr>
... more code here

{{ /blocks }}

在这种情况下,它会导致标题显示正常,标题 2 显示正常,但 HR 将被复制,是否可以通过其他方式将其设置为某些 if 语句?

【问题讨论】:

    标签: statamic


    【解决方案1】:

    如果将&lt;hr&gt; 移到 if 语句中,则不会重复。

    【讨论】:

      猜你喜欢
      • 2017-08-30
      • 2020-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-26
      • 1970-01-01
      相关资源
      最近更新 更多