Decap CMS Collections Configuration Setup
Collections — central element of config.yml. Each collection defines content type: where files store, how named, what fields available. Properly configured collections make difference between usable CMS and confusing fields set.
Two Collection Types
Folder collection — list of similar records (articles, cases, jobs):
collections:
- name: blog
label: Blog
folder: content/blog
create: true
delete: true
slug: "{{slug}}"
fields:
- { label: Title, name: title, widget: string }
- { label: Body, name: body, widget: markdown }
Files collection — fixed page set (home, about, contacts):
- name: pages
label: Pages
files:
- label: Home Page
name: home
file: content/home.yaml
fields:
- { label: Hero Title, name: hero_title, widget: string }
- label: About
name: about
file: content/about.md
fields:
- { label: Body, name: body, widget: markdown }
Field Widgets
Complete widget set for real projects:
fields:
- { label: String, name: title, widget: string, required: true }
- { label: Text, name: description, widget: text }
- { label: Number, name: order, widget: number, value_type: int }
- { label: Boolean, name: featured, widget: boolean, default: false }
- { label: Date, name: date, widget: datetime, format: "YYYY-MM-DD" }
# Select from list
- label: Category
name: category
widget: select
options: [{label: News, value: news}, {label: Cases, value: cases}]
# Media file
- { label: Cover, name: cover, widget: image, required: false }
# Markdown editor
- { label: Body, name: body, widget: markdown, modes: [rich_text, raw] }
# List of strings
- { label: Tags, name: tags, widget: list }
# Nested object
- label: SEO
name: seo
widget: object
fields:
- { label: Meta Title, name: title, widget: string }
- { label: Meta Description, name: description, widget: text }
# List of objects
- label: Features
name: features
widget: list
fields:
- { label: Icon, name: icon, widget: string }
- { label: Title, name: title, widget: string }
File Name Templates
slug determines created file name. Template variables available:
# Date + slug from title
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
# Result: 2025-03-15-my-first-post.md
# Only slug
slug: "{{slug}}"
# Custom field
slug: "{{fields.id}}-{{slug}}"
Sorting and Filtering
- name: team
label: Team
folder: content/team
sortable_fields: ['name', 'position', 'order']
view_filters:
- label: Active Only
field: active
pattern: true
- label: Managers
field: department
pattern: management
view_groups:
- label: By Department
field: department
Conditional Fields
fields:
- label: Block Type
name: type
widget: select
options: [text, video, gallery]
- label: Text
name: text
widget: markdown
condition:
field: type
value: text
- label: Video URL
name: video_url
widget: string
condition:
field: type
value: video
i18n Collections
i18n:
structure: multiple_files
locales: [en, uk]
default_locale: en
collections:
- name: services
label: Services
folder: content/services
i18n: true
fields:
- { label: Title, name: title, widget: string, i18n: true }
- { label: Slug, name: slug, widget: string, i18n: duplicate }
- { label: Body, name: body, widget: markdown, i18n: true }
Timeline
5–8 content types: 4–8 hours. With i18n, conditionals, relations: 1–2 days.







