Jekyll: Error de sintaxis líquida

Creado en 17 sept. 2016  ·  3Comentarios  ·  Fuente: jekyll/jekyll

  • [ ] Creo que esto es un error, no una pregunta sobre el uso de Jekyll.
  • [x] Actualicé a la última versión de Jekyll (o) si en las páginas de GitHub a la última github-pages
  • [x] Leí el archivo CONTRIBUCIÓN en https://jekyllrb.com/docs/contributing/
  • [ ] Esta es una solicitud de función.

  • [ ] Estoy en (o he probado) _macOS _ 10+
  • [x] Estoy en (o he probado) _Debian/Ubuntu _ GNU/Linux
  • [ ] Estoy en (o he probado) _Fedora _ GNU/Linux
  • [ ] Estoy en (o he probado) _Arch _ GNU/Linux
  • [ ] Estoy en (o he probado) _Otro _ GNU/Linux
  • [ ] Estoy en (o he probado) _Windows _ 10+

  • [ ] Estaba tratando de instalar.
  • [ ] Hay una API de complemento rota.
  • [ ] Tuve un error en las páginas de GitHub y lo reproduje localmente.
  • [ ] Tuve un error en las páginas de GitHub y el soporte de GitHub dijo que era un error de Jekyll.
  • [ ] Tuve un error en las páginas de GitHub y no lo probé localmente.
  • [ ] Estaba tratando de construir.
  • [x] Era otro error.

    Mis pasos de reproducción

Recibo la siguiente advertencia durante la compilación, ¿cómo puedo solucionarlo?

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

categoría.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

Comentario más útil

@MertcanGokgoz Su enlace es 404ing. ¿Puedes ofrecer una solución?

Editar: parece que site.tags.[page.tag] debería reemplazarse por site.tags[page.tag] (eliminando el punto)

Todos 3 comentarios

Esto no es un error.

Para obtener ayuda sobre el uso de Jekyll, publique su pregunta en https://talk.jekyllrb.com

Como indica el mensaje de error, site.categories.[page.category] no es válido.

@MertcanGokgoz Su enlace es 404ing. ¿Puedes ofrecer una solución?

Editar: parece que site.tags.[page.tag] debería reemplazarse por site.tags[page.tag] (eliminando el punto)

¿Fue útil esta página
0 / 5 - 0 calificaciones