gpt4 book ai didi

Jekyll - 获取多个类别中的所有帖子

转载 作者:行者123 更新时间:2023-12-03 23:25:30 24 4
gpt4 key购买 nike

我想遍历所有分配了类别“foo”和类别“bar”的帖子..

{% for post in site.categories.foo and in site.categories.bar %}

这可能吗?

在我的情况下,“foo”作为“父”类别到“bar”...... /foo/bar/_posts
谢谢

最佳答案

完全有可能:循环所有帖子,然后选择想要的帖子:

{% for post in site.posts %}
{% if post.categories contains "foo" or post.categories contains "bar" %}
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endif %}
{% endfor %}

关于Jekyll - 获取多个类别中的所有帖子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23050938/

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