【问题标题】:Can this be a Bug in Jekyll? ('endfor' unknown tag)这可能是 Jekyll 中的错误吗? ('endfor' 未知标签)
【发布时间】:2016-02-14 21:49:16
【问题描述】:

今天刚开始使用 Jekyll,我遇到了问题...这是我的错误消息:

Unknown tag 'endfor' in _includes/masonry.html

我看不出错误的原因。请帮我! 这是 jekyll 认为错误的代码:

<div class="gallery masonry-gallery no-margin">
    {% for item in page.slideshow %}
                            <figure class="gallery-item">
                                <header class='gallery-icon'>
                                    <a href="{% if item.image_small %}{{ item.image_small }}{{ endif }}" class="popup"><img src="{{ item.image }}" alt="" /></a>
                                </header>   
                                <figcaption class='gallery-caption'>
                                    <div class="entry-summary">
                                        <h3>{% if item.caption %}{{ item.caption }}{% endif %}</h3>
                                        <p>{% if item.description %}{{ item.description }}{% endif %}</p>
                                    </div>
                                </figcaption>
                            </figure>

    {% endfor %}

有趣的是,当我取出 for 循环时,我得到了这个:

Liquid syntax error: 'if' tag was never closed

对我来说绝对没有意义...请帮助我!!!

提前致谢, 最大

【问题讨论】:

  • 我已经阅读了 347 个以“这可能是错误吗?”开头的问题。一个是错误。

标签: ruby jekyll liquid


【解决方案1】:
<a href="{% if item.image_small %}{{ item.image_small }}{{ endif }}" class="popup"><img src="{{ item.image }}" alt="" /></a>

应该是

<a href="{% if item.image_small %}{{ item.image_small }}{% endif %}" class="popup"><img src="{{ item.image }}" alt="" /></a>

【讨论】:

  • 你的意思是{% endif %}? (我想你错过了%。)
  • 是的,谢谢,我删除了大括号,但没有添加百分比。
猜你喜欢
  • 1970-01-01
  • 2021-08-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-01
  • 2016-03-18
  • 2012-06-05
相关资源
最近更新 更多