Entry Collections
An entry collection contains multiple entries of the same type. Editors can usually create, edit, and delete entries within the collection. Typical use cases for entry collections include blog posts, tags, products or events. Each entry in the collection is represented by a separate file, or all the entries can be stored in a single JSON file.
Note for Netlify/Decap CMS users
In Sveltia CMS, what was previously referred to as a folder collection in Netlify/Decap CMS is now called an entry collection. This change was made to better reflect the purpose and functionality of these collections within the CMS.
Creating an Entry Collection
Here is an example configuration defining a simple blog posts collection:
collections:
- name: blog
label: Blog Posts
label_singular: Blog Post
folder: content/blog
fields:
- { name: title, label: Title }
- { name: body, label: Body, widget: richtext }[[collections]]
name = "blog"
label = "Blog Posts"
label_singular = "Blog Post"
folder = "content/blog"
[[collections.fields]]
name = "title"
label = "Title"
[[collections.fields]]
name = "body"
label = "Body"
widget = "richtext"{
"collections": [
{
"name": "blog",
"label": "Blog Posts",
"label_singular": "Blog Post",
"folder": "content/blog",
"fields": [
{ "name": "title", "label": "Title" },
{ "name": "body", "label": "Body", "widget": "richtext" }
]
}
]
}{
collections: [
{
name: "blog",
label: "Blog Posts",
label_singular: "Blog Post",
folder: "content/blog",
fields: [
{ name: "title", label: "Title" },
{ name: "body", label: "Body", widget: "richtext" },
],
},
],
}Options
The following options are commonly used when defining an entry collection:
name: (required) A unique identifier for the collection. Should not contain spaces or special characters.label: A human-readable name for the collection. If omitted, thenamevalue is used.label_singular: A human-readable singular name for the collection. If omitted, thelabelvalue is used. Used in some parts of the UI like the “Create new” button.description: A brief description of the collection, displayed in the UI. Basic Markdown formatting is supported, including bold, italic, strikethrough, code, and links.folder: (required unlessfileis used) The folder path where the entries are stored, relative to the repository’s root directory. It can be an empty string (or.or/) to store entries in the root folder. With i18n enabled, it can contain the{{locale}}placeholder as a folder name, e.g.content/{{locale}}/posts, to say where the locale folder goes. See Custom Locale Folder Placement.file: The path to a JSON file storing all the entries as an array of objects, used instead offolder. See Single-File Collections.fields: (required) An array defining the fields for each entry in the collection. Each field has aname,label, and optionalwidgettype.
Configuration Guides
The remaining entry collection options are documented on the following pages:
- File Formats: Choose between Markdown with front matter, YAML, JSON and TOML, and customize the file extension, front matter delimiter and body field.
- Slugs and File Paths: Generate entry slugs from fields and template tags, make slugs editable, and organize entries into subfolders and page bundles.
- Nested Collections: Manage hierarchical content in a folder tree that editors can browse and organize.
- Single-File Collections: Store all the entries in one JSON file, as an array of objects.
- Preview Paths and Redirects: Point the CMS at an entry’s URL on your site for previews, and record redirects when slugs change.
- Entry Operations: Disable creation, deletion or duplication, limit the entry count, hide the collection, and enable manual reordering.
- Entry Listings: Customize entry summaries and thumbnails, manage Hugo’s index file, and include or exclude entries.
- Entry Views: Define sorting, grouping and filtering options for the listing view.