Jekyll 中的循环和变量如何处理?
How does the loops and variables in Jekyll?
当我比较时,如果 post.category 好像有一个 post,当我输入 {{post.category}} 时,变量更多,它会打印名称。如果我输入 if site.post.category handle all values,这就像他不存在于大多数情况下一样。问题是我想获取当前 post 来比较该类别。我想按类别列出 post。
<div class="posts">
{% for post in site.posts %}
{% if post.category == Eventos %}
<hr>
<div class="post">
<h1 class="post-title">
<a href="{{ site.url }}{{post.url}}">
{{ post.title }}
</a>
</h1>
<span class="post-date">{{ post.date | date_to_string }} / {{ post.category }}</span> {{ post.excerpt }}
<h6><a href="{{ site.url }}{{post.url}}">Leia mais...</a></h6>
</div>
{% endif %}
{% endfor %}
</div>
尝试 类别 !
{% if post.categories | contains: 'Eventos' %}
当我比较时,如果 post.category 好像有一个 post,当我输入 {{post.category}} 时,变量更多,它会打印名称。如果我输入 if site.post.category handle all values,这就像他不存在于大多数情况下一样。问题是我想获取当前 post 来比较该类别。我想按类别列出 post。
<div class="posts">
{% for post in site.posts %}
{% if post.category == Eventos %}
<hr>
<div class="post">
<h1 class="post-title">
<a href="{{ site.url }}{{post.url}}">
{{ post.title }}
</a>
</h1>
<span class="post-date">{{ post.date | date_to_string }} / {{ post.category }}</span> {{ post.excerpt }}
<h6><a href="{{ site.url }}{{post.url}}">Leia mais...</a></h6>
</div>
{% endif %}
{% endfor %}
</div>
尝试 类别 !
{% if post.categories | contains: 'Eventos' %}