【发布时间】:2016-02-09 03:01:22
【问题描述】:
我正在使用 jekyll 在 github.io 上托管一个网站
主页有一个“最近的帖子”部分,显示最新的 10 个帖子。
我在 index.html 中使用以下代码来生成列表:
<ul class="post-list">
{% for post in site.posts limit:10 %}
<li><article><a href="{{ site.url }}{{ post.url }}">{{ post.title }} <span class="entry-date"><time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: "%B %d, %Y" }}</time></span>{% if post.excerpt %} <span class="excerpt">{{ post.excerpt }}</span>{% endif %}</a></article></li>
{% endfor %}
</ul>
_posts 目录有 3 个子目录。上面的代码从所有三个目录生成一个列表。我想在“最近的帖子”目录中排除其中一个目录中的帖子。
更一般地,如何选择 _posts 目录中的子目录子集?
【问题讨论】: