Jekyll Collections Versus Posts

  • Published: July 12, 2016


These are the main differences between Collections and posts.


A post in a subdirectory structure automatically gets subdirectories names as its categories.

A collection does not have categories by default.

_Categories_ can be assigned to _collections_ with a parameter in each file _front matter_.


Post filenames must be in the format YYYY-MM-DD-title.<markup> which assigns the post date, used to sort posts by creation date.

Collection filenames doesn’t need any special format in filenames, they get the date from the file creation date.

In both cases, the document's date can be overwritten in the front matter of each file setting the date variable. (i.e. date: 2016-06-08)


Posts have the restriction of being only recognized if they are located under a _posts folder. This restriction won’t be removed as it is being kept to not break previous versions.

Collections can be located directly in any directory of the collection folder.


This is one of the most important difference between them.

Posts were originally aimed for blogs, so the date is a central concept that is also displayed in its filename, they are not likely to get updated after published.

└── _posts
  • Beside collections have a date property, this is not an important concept as it is in posts, a clear structure is needed to locate each file quickly when needed to update or add data to them.
└── _my_collection


Considering publishing a list of books with both approaches:

  • a list of standard posts in books folder.
  • a collection in _books folder, with the following configuration:

    • In /_config.yml:
          output: true
Note the underscore as the first character of the collection folder /_books, needed to let Jekyll handle the directory as a collection.

This is how they basically compare:

{{ page.categories }}["books", "science"]
{{ }}from file creation date:
2016-07-11 23:03:59 |
from filename: 2016-06-10
Document accesssite.books
site.posts |
File handling the URL with permalink: "/books/science"

Choosing between Collections and Posts

Features of Collections:

  • a cleaner directory/subdirectories structure without _posts folder in each nested level
  • cleaner filenames without mandatory dates.
  • In a hierarchical subdirectoy structure, categories can be simulated processing the path property of each file.
  • Collection filenames put more emphasis in its title, not the date.

Features of Posts:

  • Posts were introduced in Jekyll before collections, so they are widely adopted and with more plugins available.
  • Posts filenames put more emphasis in dates, not the titles.
  • when using nested directories, creating each subdirectory index is straightforward.


Marcelo Canina
I'm Marcelo Canina, a developer from Uruguay. I build websites and web-based applications from the ground up and share what I learn here.
comments powered by Disqus
Except as otherwise noted, the content of this page is licensed under CC BY-NC-ND 4.0 ·