无法在jekyll中找到错误..."在解析块映射时找不到预期的键"

时间:2016-07-09 14:02:13

标签: html yaml jekyll liquid

我是jekyll和Liquid的相对新手。我不久前跑了这个,但不管怎么说都搞砸了,没有备份。找到的东西时,错误只会转移到其他地方......请看一看。

这是我的代码:

---
title: Gallery
layout: gallery
heroimage: /img/hero-image-gallery.jpg
imgsize: small
masonry:
itemsize: 33.333%
categories:
- Objects
- People
- Places
images:
- title: one
  thumb: img/gallery-image-one.jpg
  big: img/gallery-image-one.jpg
  categories:
    - People
    - Places
- title: two
  thumb: img/gallery-image-two.jpg
  big: img/gallery-image-two.jpg
  categories:
    - Objects
    - Places
- title: three
  thumb: img/gallery-image-three.jpg
  big: img/gallery-image-three.jpg
  categories:
    - People
- title: four
  thumb: img/gallery-image-four.jpg
  big: img/gallery-image-four.jpg
  categories:
    - Objects
    - Places
- title: five
  thumb: img/gallery-image-five.jpg
  big: img/gallery-image-five.jpg
  categories:
    - Objects
- title: eight
  thumb: img/gallery-image-eight.jpg
  big: img/gallery-image-eight.jpg
  categories:
    - Places
- title: seven
  thumb: img/gallery-image-seven.jpg
  big: img/gallery-image-seven.jpg
  categories:
    - Places
- title: six
  thumb: img/gallery-image-six.jpg
  big: img/gallery-image-six.jpg
  categories:
    - Objects
    - People
 - title: bla
  thumb: img/gallery-image-six.jpg
  big: img/gallery-image-six.jpg
  categories:
    - Objects
    - People
---
<div class="portfolioFilter">

    <a href="#" data-filter="*" class="current">Alle</a>
    {% for cat in page.categories %}
        <a href="#" data-filter=".{{ cat | slugify }}">{{cat}}</a>
    {% endfor %}

</div><br>
<div class="grid">
  <div class="grid-sizer"></div>
  {% for item in page.images %}
  <div class="grid-item{% for cat in item.categories %} {{cat | slugify}}{% endfor %}">
    <a class="example-image-link" href="{{item.big}}" data-lightbox="example-set" ><img src="{{item.thumb}}"/></a>
  </div>
  {% endfor %}
</div>

这是我得到的错误:

Error reading file /Users/maxborm/Desktop/lukawebsite/gallery.html: (<unknown>): did not find expected key while parsing a block mapping at line 2 column 1 

提前致谢。

1 个答案:

答案 0 :(得分:2)

缩进在Liquid中非常重要,您必须确保在声明集合时有足够的空格。

在您的情况下,- title: bla之前有一个额外的空格导致错误。

即。你有:

 - title: bla

你什么时候应该:

- title: bla