Jekyll 3 没有在 include 中获取自定义 collection

Jekyll 3 not picking up custom collection in include

我有一个简单的 Jekyll 网站,我是从 Jekyll 模板开发的。我正在努力让它在 netlifycms 中可编辑。

我已经将 collections 移动到自定义目录 customcollections 中,在 _config.yml 中指定了它,并将 _posts 目录移动到了那里。这很好用。

然后我包含了 includes/components 中的一个组件,以引入并迭代自定义 collection _navtiles。

出于某种原因,当我尝试遍历 navtiles 时:

<div class="features">
        <h3>---NAVTILES</h3>
    {% for navtile in site.navtiles %}
        <section class="post">
            <span class="image"><img src="{{ site.baseurl }}{{ navtile.image }}" alt="" /></span>
            <div class="content">
                <h3>{{ navtile.title }}</h3>
                <p>{{ navtile.body | remove: "<p>" | remove: "</p>" }}</p>
                {% if navtile.url %}
                    <ul class="actions">
                        <li><a href="{{ navtile.url }}" class="button">More</a></li>
                    </ul>
                {% endif %}
            </div>
        </section>
    {% endfor %}
</div>

它不会拉入存在于 customcollections/_navtiles/

中的 navtile collection object

但是,如果我将 site.navtiles 更改为 site.posts,那么它会非常愉快地提取所有博客文章。

任何人都可以告诉我做错了什么吗? 网站在这里: index.html - https://github.com/tofuwarrior/sites-clearspringacupuncture/blob/master/index.html

_config.yml - https://github.com/tofuwarrior/sites-clearspringacupuncture/blob/master/_config.yml

_includes/components/navtiles.html - https://github.com/tofuwarrior/sites-clearspringacupuncture/blob/master/_includes/components/navtiles.html

组件被愉快地拉入index.html

网站预览在这里: http://dev.clearspringacupuncture.co.uk/

我很困惑,因为它与 _posts 一起工作很好我觉得我一定是缺少对 jekyll collections 的一些理解,因为我是 jekyll 的新手。 谁能指出我正确的方向 谢谢。 杰基尔

您只需为您的自定义集合配置 Jekyll。

在_config.yml中:

collections:
  navtiles:

参见documentation