I ended up here because I wanted to create the following structure:
index.html
_animals
cats
my-cat.html
...
dogs
my-dog.html
...
I created this structure, then in _config.yml:
collections:
animals:
output: true
permalink: /animal/:title.html
Finally, to get only dogs in index.html:
<div id='dogs'>
{% for a in site.animals %}
{% if a.path contains 'dogs' %}
<a href='{{ a.url }}'>{{ a.title }}</a>
{% endif %}
{% endfor %}
</div>
NB: that this approach requires that the directory containing all entries ( _animalsin my example) cannot be named _posts, since the latter is a special name in Jekyll.
source
share