0
votes

I have a simple jekyll site whcih I am developing from a jekyll template. I'm working on making it editable in netlifycms.

I've moved collections into custom directory customcollections, have specified this in _config.yml and have moved _posts directory in there. This works fine.

I have then included a component from includes/components to pull in and iterate through a custom collection _navtiles.

For some reason when I try to iterate through navtiles thus:

<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>

it doesn't pull in the navtile collection object that is present in customcollections/_navtiles/

But if I change site.navtiles to be site.posts then it pulls in all the blog posts quite happily.

Can anyone advise what I am doing wrong? Site is here: 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

the component is pulled into index.html happily.

site preview is here: http://dev.clearspringacupuncture.co.uk/

I'm stumped because it works fine with _posts I feel I must be missing some understanding of jekyll collections as I am new to jekyll. Can anyone point me in the right direction Thanks. jekyll

1

1 Answers

0
votes

You simply need to configure Jekyll for your custom collection.

In _config.yml :

collections:
  navtiles:

See documentation.