Jekyll: 液体语法错误

创建于 2016-09-17  ·  3评论  ·  资料来源: jekyll/jekyll

  • [ ] 我认为这是一个错误,而不是关于使用 Jekyll 的问题。
  • [x] 如果在 GitHub Pages 上更新到最新的 Jekyll(或)到最新的github-pages
  • [x] 我在https://jekyllrb.com/docs/contributing/阅读了 CONTRIBUTION 文件
  • [ ] 这是一个功能请求。

  • [ ] 我正在(或已测试) _macOS _ 10+
  • [x] 我正在(或已测试) _Debian/Ubuntu _ GNU/Linux
  • [ ] 我正在(或已经测试过) _Fedora _ GNU/Linux
  • [ ] 我正在(或已经测试过) _Arch _ GNU/Linux
  • [ ] 我正在(或已测试) _Other _ GNU/Linux
  • [ ] 我正在(或已测试) _Windows _ 10+

  • [ ] 我正在尝试安装。
  • [ ] 插件 API 损坏。
  • [ ] 我在 GitHub Pages 上遇到了错误,我已经在本地复制了它。
  • [ ] 我在 GitHub Pages 上有一个错误,GitHub 支持人员说这是一个 Jekyll Bug。
  • [ ] 我在 GitHub Pages 上有一个错误,我没有在本地测试它。
  • [ ] 我正在尝试构建。
  • [x] 这是另一个错误。

    我的复制步骤

我在编译过程中收到以下警告,我该如何解决这个问题

Liquid Warning: Liquid syntax error (line 5): Expected id but found open_square in "item in site.[item.label]" in feeds/feed.json
    Liquid Warning: Liquid syntax error (line 19): Expected id but found open_square in "post in site.categories.[page.category]" in /_layouts/category.html
    Liquid Warning: Liquid syntax error (line 19): Expected id but found open_square in "post in site.categories.[page.category]" in /_layouts/category.html
    Liquid Warning: Liquid syntax error (line 19): Expected id but found open_square in "post in site.categories.[page.category]" in /_layouts/category.html
    Liquid Warning: Liquid syntax error (line 19): Expected id but found open_square in "post in site.categories.[page.category]" in /_layouts/category.html
    Liquid Warning: Liquid syntax error (line 19): Expected id but found open_square in "post in site.categories.[page.category]" in /_layouts/category.html
    Liquid Warning: Liquid syntax error (line 19): Expected id but found open_square in "post in site.categories.[page.category]" in /_layouts/category.html
    Liquid Warning: Liquid syntax error (line 19): Expected id but found open_square in "post in site.categories.[page.category]" in /_layouts/category.html
    Liquid Warning: Liquid syntax error (line 19): Expected id but found open_square in "post in site.categories.[page.category]" in /_layouts/category.html
    Liquid Warning: Liquid syntax error (line 19): Expected id but found open_square in "post in site.categories.[page.category]" in /_layouts/category.html

类别.html

<h1 class="title">{{ page.title }}</h1>

{% unless page.content == '' %}
  <p>{{ page.content }}</p>
{% endunless %}
<ul id="blog-posts" class="posts">
{% for post in site.categories.[page.category] %}
  <li><span>{{ post.date | date: "%d/%m/%Y" }} &raquo;</span><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>

饲料.json

{% assign first = true %}
[
{% for collection in site.collections %}
    {% for item in collection %}
        {% for item in site.[item.label] %}
            {% if item.title != null and item.title != empty %}
            {% unless first %},{% endunless %}{
                "title": {{item.title | jsonify}},
                "content": {{item.content | markdownify | strip_html | jsonify}},
                "link": "{{ site.baseurl }}{{ item.url }}",
                "date": "{{ item.date }}",
                "excerpt": "{{ item.snippet }}",
                "search_omit": "{{ item.search_omit }}"
            }
            {% assign first = false %}
            {% endif %}
        {% endfor %}
    {% endfor %}
{% endfor %}


{% for post in site.posts %}
    {% if post.title != null and post.title != empty %}
    {% unless first %},{% endunless %}{
        "title": {{post.title | jsonify}},
        "content": {{post.content | markdownify | strip_html | jsonify}},
        "link": "{{ site.baseurl }}{{ post.url }}",
        "date": "{{ post.date }}",
        "excerpt": "{{ post.snippet }}",
        "search_omit": "{{ post.search_omit }}"
    }
    {% assign first = false %}
    {% endif %}
{% endfor %}

{% for page in site.pages %}
    {% if page.title != null and page.title != empty %}
    {% unless first %},{% endunless %}{
        "title": {{page.title | jsonify}},
        "content": {{page.content | strip_html | jsonify}},
        "link": "{{ site.baseurl }}{{ page.url | replace: 'index.html', '' }}",
        "date": {{ page.date | jsonify }},
        "excerpt": {{ page.description | jsonify }},
        "search_omit": "{{ page.search_omit }}"
    }
    {% assign first = false %}
    {% endif %}
{% endfor %}
]
frozen-due-to-age

最有用的评论

@MertcanGokgoz您的链接是 404ing。 你能提供一个解决方案吗?

编辑:似乎site.tags.[page.tag]应该替换为site.tags[page.tag] (删除点)

所有3条评论

这不是错误。

有关使用 Jekyll 的帮助,请在https://talk.jekyllrb.com上发布您的问题

如错误消息所述, site.categories.[page.category]无效。

@MertcanGokgoz您的链接是 404ing。 你能提供一个解决方案吗?

编辑:似乎site.tags.[page.tag]应该替换为site.tags[page.tag] (删除点)

此页面是否有帮助?
0 / 5 - 0 等级