Jekyll Collections - 跳过索引页

Jekyll Collections - Skip index page

我的 Jekyll 站点中有以下文件夹结构:

...
_machine-learning
|- my-first-post.md
|- index.html 
...

我想安排我的网站,以便当有人访问 http://example.com/machine-learning/ 时,他们可以看到整齐列出的所有 collection 页面。

为此,我在 index.html 中添加了以下内容:

<h1 class="page-heading">Machine Learning</h1>

<ul class="post-list">
  {% for item in site.machine-learning %}
    <a href="{{ item.url | prepend: item.baseurl }}">{{ item.title }}</a>
  {% endfor %}
</ul>

这工作正常,但唯一的问题是它也在那里显示我的 index.html,使一切看起来一团糟。

我是不是做错了什么?如何遍历 collection,跳过索引?

我刚刚更改了文件夹结构,将 index.html 文件从 machine-learning/ 集合中移动到 machine-learning.html 的根文件夹中。 URL 保持不变(示例。com/machine-learning)并且它没有出现在 site.machine-learning 列表中。

之前:

...
_machine-learning
|- my-first-post.md
|- index.html 
...

之后:

...
machine-learning.html
_machine-learning
|- my-first-post.md
...