Collections are simply a group of Entries, quite similar to Pages in many ways. While each Page tends to be unique, Entries all share the same data structure and are "mounted" to a section of the site.
Collections can be anything. Blog posts, news articles, knock knock jokes, you name it. Other content management systems might call them “channels”, “structures”, or “post types”.
You can create as many collections as you’d like, each with its own default group of custom fields (called a “Fieldset”). Each Collection can contain any number of Entries with a date or numerical
order_key and a slug for a filename:
By their very nature, Collections don’t determine their own full URLs. To do so would limit their flexibility. Instead, you can “mount” a collection onto any page (or pages) and then write a route to determine their URL structure. This opens many, many, many possibilities. That’s three (3) manys, in case you were counting.
It’s really easy to mount a collection to a page, simply click the 3 dots to the right of the page name, when in the index view of pages, and mount a selected collection. Or if you want to add it to the
site/content/pages/news/index.md file (if mounting the news collection for example), specify it there with
Collections are kept in
site/content/collections, each in their own subfolder, and contain a flat list of Entries in a YAML Front-Loaded format (there’s that term again).
collections/ |-- blog/ | |-- 2015-01-18.my-first-day.md | |-- 2015-01-19.paperwork-and-snowshoeing.md | |-- 2015-03-08.spring-wonderful-spring.md | |-- 2015-05-16.speeder-bikes-and-wookies.md |-- news/
Entries are designed to be viewable each at their own unique URL. There certainly are exceptions to this rule, and no technical limitation preventing you from writing multiple routes and serving the same collections in multiple locations. But be sure to make the right decisions for the quality of your site, because duplicate content is something to avoid when it comes to your search result rankings.
Mounted Collections show up in the Page Tree of the Control Panel as an easy way for content managers to jump directly into publishing, as well as to aid in contextualizing their location within the site.
You may customize the columns in this listing. Find out how
If you’d like your Entries to inherit some default data, such as a default template, fieldset, or list of taxonomies, you can add that data to the Collections
folder.yaml file. Each entry can override this data if you desire. Anything goes.
# /site/content/collections/blog/folder.yaml template: post show_comments: false author: jack