【发布时间】:2019-07-31 00:42:15
【问题描述】:
我有一个简单的 jekyll 网站,我正在从 jekyll 模板开发。我正在努力让它在 netlifycms 中可编辑。
我已将集合移至自定义目录 customcollections,已在 _config.yml 中指定此内容,并将 _posts 目录移至其中。这很好用。
然后我从包含/组件中包含一个组件,以拉入并遍历自定义集合 _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 集合对象
但是,如果我将 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