gpt4 book ai didi

Jekyll 按类别显示帖子

转载 作者:行者123 更新时间:2023-12-03 06:34:04 25 4
gpt4 key购买 nike

对此感到困惑 - 非常感谢您的帮助。

我想显示我所有 Jekyll 帖子的列表,按类别组织。我知道第 3 行不正确,但我不知道它应该是什么。有任何想法吗?谢谢!

{% for category in site.categories %}
<h3>{{ category | first }}</h3>
{% for post in page.categories.category %}
{{ post.title }}<br>
{% endfor %}
{% endfor %}

最佳答案

明白了!在列出各个帖子之前需要一个中间帖子循环

<ul>
{% for category in site.categories %}
<li><a name="{{ category | first }}">{{ category | first }}</a>
<ul>
{% for post in category.last %}
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>

关于Jekyll 按类别显示帖子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20872861/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com