[英]How does the loops and variables in Jekyll?
当我比较时,如果post.category就好像有一个帖子那个变量更多的是当我放{{post.category}}时它打印出名字。 如果我放入,如果site.post.category处理所有值,那就好像他不存在。 问题是我希望得到当前帖子来比较该类别。 我想按类别列出帖子。
<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' %}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.