Jekyll’s Collections provide powerful tools to organize content. Ben Balter put together an excellent write-up about using Collections with Jekyll. And the Jekyll documentation is super helpful as well.
Here’s what I did, to demonstrate Jekyll Collections:
<source>/_my_collection_name
<source>/_my_collection_name
_config.yml
:
collections:
my_collection_name:
output: true
permalink: /level1/level2/:title.html
defaults:
- scope:
path: ""
type: my_collection_name
values:
layout: post
Create a page, e.g. <source>/allcontent.md
, to display all the content in the collection
---
title: All the content in the collection
layout: post
permalink: allcontent.html
---
{% if site.my_collection_name.size > 0 %}
<ul>
{% for a-content in site.my_collection_name %}
<li>
<strong><a href="{{ a-content.url }}">{{ a-content.title }}</a></strong> / <time datetime="{{ a-content.date | date_to_xmlschema }}">{{ a-content.date | date: '%b %-d, %Y'}}</time>
{{ a-content.excerpt }}
</li>
{% endfor %}
</ul>
{% else %}
<p>No content in this collection yet!</p>
{% endif %}