在 Jekyll 中过滤帖子

Filtering posts in Jekyll

我有一份关于 Jekyll 的报纸 运行。在主页上有一堆最新的帖子,在它们下面有按各种有趣主题分组的帖子。例如:

现在,在发表意见时,我不想重复当前头条下已经列出的故事。有没有一种简单的方法可以在没有任何 Jekyll 插件的情况下在 Liquid 中表达它?

循环遍历所有带有偏移量的帖子,并对类别使用 if 语句。可以在此处找到偏移量:https://help.shopify.com/themes/liquid/tags/iteration-tags

{% for post in site.posts offset:9 %}
 {% if post.categories contains 'mycat' %}
  {{ post.title }}
 {% endif %}
{% endfor %}