Jekyll: Kesalahan sintaks cair

Dibuat pada 17 Sep 2016  ·  3Komentar  ·  Sumber: jekyll/jekyll

  • [ ] Saya yakin ini adalah bug, bukan pertanyaan tentang penggunaan Jekyll.
  • [x] Saya memperbarui ke Jekyll terbaru (atau) jika di Halaman GitHub ke github-pages terbaru
  • [x] Saya membaca file KONTRIBUSI di https://jekyllrb.com/docs/contributing/
  • [ ] Ini adalah permintaan fitur.

  • [ ] Saya menggunakan (atau telah menguji) _macOS _ 10+
  • [x] Saya aktif (atau telah menguji) _Debian/Ubuntu _ GNU/Linux
  • [ ] Saya aktif (atau telah menguji) _Fedora _ GNU/Linux
  • [ ] Saya aktif (atau telah menguji) _Arch _ GNU/Linux
  • [ ] Saya aktif (atau telah menguji) _Other _ GNU/Linux
  • [ ] Saya aktif (atau telah menguji) _Windows _ 10+

  • [ ] Saya mencoba menginstal.
  • [ ] Ada API Plugin yang rusak.
  • [ ] Saya mengalami kesalahan pada Halaman GitHub, dan saya telah mereproduksinya secara lokal.
  • [ ] Saya mengalami kesalahan pada Halaman GitHub, dan Dukungan GitHub mengatakan itu adalah Bug Jekyll.
  • [ ] Saya mengalami kesalahan pada Halaman GitHub dan saya tidak mengujinya secara lokal.
  • [ ] Saya mencoba membangun.
  • [x] Itu adalah bug lain.

    Langkah Reproduksi Saya

Saya mendapatkan peringatan berikut selama kompilasi, bagaimana saya bisa memperbaikinya

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

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

Komentar yang paling membantu

@MertcanGokgoz Tautan Anda 404ing. Bisakah Anda menawarkan solusi?

Sunting: Tampaknya site.tags.[page.tag] harus diganti dengan site.tags[page.tag] (menghilangkan titik)

Semua 3 komentar

Ini bukan bug.

Untuk bantuan dalam menggunakan Jekyll, silakan kirim pertanyaan Anda di https://talk.jekyllrb.com

Seperti yang dinyatakan oleh pesan kesalahan, site.categories.[page.category] tidak valid.

@MertcanGokgoz Tautan Anda 404ing. Bisakah Anda menawarkan solusi?

Sunting: Tampaknya site.tags.[page.tag] harus diganti dengan site.tags[page.tag] (menghilangkan titik)

Apakah halaman ini membantu?
0 / 5 - 0 peringkat