Jekyll: Liquid syntax error

Created on 17 Sep 2016  ·  3Comments  ·  Source: jekyll/jekyll

  • [ ] I believe this to be a bug, not a question about using Jekyll.
  • [x] I updated to the latest Jekyll (or) if on GitHub Pages to the latest github-pages
  • [x] I read the CONTRIBUTION file at https://jekyllrb.com/docs/contributing/
  • [ ] This is a feature request.

  • [ ] I am on (or have tested on) _macOS_ 10+
  • [x] I am on (or have tested on) _Debian/Ubuntu_ GNU/Linux
  • [ ] I am on (or have tested on) _Fedora_ GNU/Linux
  • [ ] I am on (or have tested on) _Arch_ GNU/Linux
  • [ ] I am on (or have tested on) _Other_ GNU/Linux
  • [ ] I am on (or have tested on) _Windows_ 10+

  • [ ] I was trying to install.
  • [ ] There is a broken Plugin API.
  • [ ] I had an error on GitHub Pages, and I have reproduced it locally.
  • [ ] I had an error on GitHub Pages, and GitHub Support said it was a Jekyll Bug.
  • [ ] I had an error on GitHub Pages and I did not test it locally.
  • [ ] I was trying to build.
  • [x] It was another bug.

    My Reproduction Steps

I'm getting the following warning during compilation, how can i fix this

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

category.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>

feed.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

Most helpful comment

@MertcanGokgoz Your link is 404ing. Can you offer a solution?

Edit: It seems that site.tags.[page.tag] should be replaced with site.tags[page.tag] (removing the dot)

All 3 comments

This is not a bug.

For help on using Jekyll, please post your question at https://talk.jekyllrb.com

As the error message states, site.categories.[page.category] is invalid.

@MertcanGokgoz Your link is 404ing. Can you offer a solution?

Edit: It seems that site.tags.[page.tag] should be replaced with site.tags[page.tag] (removing the dot)

Was this page helpful?
0 / 5 - 0 ratings