我的 index.html 中有 Jekyll 的以下代码。我正在尝试找到一种方法将与每个帖子相关联的类别链接到实际帖子本身。因此,如果帖子包含“旅行”类别,我想点击一个显示“旅行”的链接,这会将我带到所有此类分类的帖子。
<ul class="post-list" style="list-style-type: none;">
{% for post in paginator.posts %}
{% unless post.categories contains 'portfolio' %}
<li>
<h3><a href="{{ post.url }}">{{ post.title }}</a></h3>
<span class="post-meta">{{ post.date | date: "%c" }}</span>
Filed In:
{% unless p.categories == empty %}
{% for categories in post.categories %}
<a href="/{{ categories | first }}">{{ categories }}</a> //problem area
{% endfor %}
{% endunless %}
{{ post.excerpt }} <a href="{{ post.url }}">Find out more...</a><br><br>
</li>
{% endunless %}
{% endfor %}
</ul>