To create an albums collection, add the following to your config.yml
file:
collections:
- albums
Create a corresponding folder at the root of your Jekyll install, named exactly what you put in your config.yml
file with an additional prepended underscore; in our example, <source>/_albums
.
Adding documents to this folder will add items to your collection. Any variables included in a file's YAML front matter is read in as data attributes, and everything after it is included in the item's content attribute. If no YAML front matter is provided, Jekyll will not generate the file in your collection.
Collection metadata can be configured in config.yml
:
collections:
albums:
type: media
In this example, type: media
could be any arbitrary key-value pair.
Defaults for items within a collection can also be set within config.yml
.
defaults:
- scope:
path: ""
type: albums
values:
publisher: Me Publishers Inc
Given this default, any item within the albums
collection that does not explicitly set publisher
within its front matter will have its publisher
variable set to Me Publishers Inc
at build time.
Official Jekyll Collections Docs