1

我正在使用带有大量扩展的 Jekyll。构建工作正常,但是当我调用 Jekyll serve 时,我收到以下警告:

Liquid Warning: Liquid syntax error (line 13): Unexpected character   in "{{forloop.index | minus:1 | modulo:4 }}" in .html
Liquid Warning: Liquid syntax error (line 13): Unexpected character   in "{{forloop.index | minus:1 | modulo:4 }}" in .html

这是上述文件的代码,

<section class="pt-6 pt-md-8 pb-8 mb-md-8">
  <div class="container">
  <!-- Example single danger button -->

  <center><h2>Please choose a category to view</h2></center>
  <hr>  
  {% assign color = "#DA5988,#FF5A5F,#0082C9,#6772E5" %}

  <div class="row">
    {% for category in site.categories %}
    {% assign idx = forloop.index | minus:1 | modulo:4 %}
    {% assign curr_color = color | split:',' | slice:idx %}
        <div class="col-4 mt-5">
                <!-- Card -->
                <div class="card card-border shadow-light-lg lift lift-lg" style="border-top-color: {{ curr_color }};">
                  <div class="card-body text-center">
                    <!-- Text -->
                    <h3 class="text-gray-700 mb-5" style="color:{{ curr_color }}">
                        {{ category | first | split:"-" | join:" " | upcase }}
                    </h3>
                    <!-- Link -->
                    <a href="/articles/{{ category | first }}" style="color: {{ curr_color }};">Show More</a>
                  </div>
                </div>

        </div>
      {% endfor %}
  </div>

  </div> <!-- / .container -->
</section>

您可以在第 13 行看到只有一个空格,我怎样才能摆脱这些警告?

4

1 回答 1

0

也许考虑检查类别名称本身是否有空格,看看这是否是产生错误的原因。

于 2020-04-14T12:53:46.277 回答