我无法按照集合中的标签对项目进行分组。我已经设法使用site.categories(检查下面),但我在以同样的方式从集合项目中绘制yaml属性时遇到了麻烦。
{% for imagens in site.imagens %}
<div class="card">
<ul class="lista-imagens">
<li><a class="categories" name="{{ imagens.tags | first }}">{ {{ imagens.tags | first }} }</a>
<ul >
<li>
<img src="{{ imagens.image_path }}" alt="{{ imagens.title }}">
<a href="{{ imagens.original_path }}" target="_blank">{{ imagens.title }}</a>
<span class="ano">{{ imagens.year }}</span>
</li>
</ul>
</li>
</ul>
</div>
{% endfor %}
{% for category in site.categories %}
<div class="col-md-3">
<ul class="listinha">
<li><a class="categories" name="{{ category | first }}">{ {{ category | first }} }</a>
<ul >
{% for posts in category %}
{% for post in posts %}
<li><a href="{{ post.url }}">{{ post.title }}</a> <br>
<span class="autor"> {{ post.author }} {% if post.year %}<br> {{ post.year }} {% endif %} </span><span class="contributor">{{ post.contributor }} <!-- / imgs: {{ post.imgs }}<br>--></span></li>
{% endfor %}
{% endfor %}
</ul>
</li>
</ul>
</div>
{% endfor %}