jekyll Collections Adding an Item to a Collection


Example

Given an 'albums' collection, an item can be added by creating a file in the <source>/_albums directory. Note that files not including frontmatter will be ignored.

For instance, adding a file called my_album.md to the _albums directory would add it to the collection:

---
title: "My Album"
---
...

Everything after the second set of three dashes is included in item.content. Both an item's content and its front matter variables can be accessed like so:

{% for album in site.albums %}
    {{ album.title }}
    {{ album.content }}
{% endfor %}

If you don't wish to include any front matter variables in a collection item, two sets of three dashes are sufficient front matter to have an item included:

---
---
...