Collections are the primary way to organize content in md0 CMS. A collection represents a group of content files that share the same structure and purpose, such as blog posts, documentation pages, or product listings.
What is a Collection?
A collection is a set of markdown files that:
- Live in a specific directory or path pattern in your repository
- Share a common frontmatter schema
- Represent the same content type (posts, docs, pages, etc.)
- Can be managed together as a group
Creating Your First Collection
Basic Collection Setup
- Navigate to your connected repository
- Click "Collections" in the sidebar
- Click "Create Collection"
- Fill in the collection details:
Name: Blog Posts
Label: Posts
Path Pattern: content/posts/**/*.md
Description: Blog articles and tutorials
Collection Fields
Name (required)
- Internal identifier for the collection
- Used in navigation and settings
- Example: "Blog Posts", "Documentation", "Team Members"
Label (optional)
- Plural label shown in the UI
- Defaults to name if not specified
- Example: "Posts", "Docs", "Members"
Path Pattern (required)
- Glob pattern matching files in your repository
- Determines which files belong to this collection
- Example:
content/blog/**/*.md
Description (optional)
- Helper text for content creators
- Explains the purpose of this collection
- Shows in the collection overview
Understanding Path Patterns
Path patterns use glob syntax to match files in your repository.
Basic Patterns
# Match all .md files in a specific directory
content/posts/*.md
# Match .md files recursively in subdirectories
content/posts/**/*.md
# Match both .md and .mdx files
docs/**/*.{md,mdx}
# Match files in a specific year
posts/2024/**/*.md
# Match files in multiple directories
{blog,news}/**/*.md
Pattern Components
* - Matches any characters except /
posts/*.md # Matches: posts/hello.md
# Does not match: posts/2024/hello.md
** - Matches any characters including / (recursive)
posts/**/*.md # Matches: posts/hello.md
# Matches: posts/2024/01/hello.md
{} - Matches any of the comma-separated patterns
content/{blog,docs}/**/*.md
# Matches: content/blog/post.md
# Matches: content/docs/guide.md
[] - Matches any character in the brackets
posts/202[0-4]/**/*.md
# Matches: posts/2020/post.md through posts/2024/post.md
Collection Examples
Blog Collection
Name: Blog Posts
Path Pattern: content/blog/**/*.md
Description: Blog articles, tutorials, and announcements
Matches:
content/blog/my-first-post.mdcontent/blog/2024/january/new-features.mdcontent/blog/tutorials/getting-started.md
Documentation Collection
Name: Documentation
Path Pattern: docs/**/*.mdx
Description: Product documentation and guides
Matches:
docs/getting-started.mdxdocs/api/authentication.mdxdocs/guides/deployment.mdx
Multiple Collections
Create separate collections for different content types:
# Collection 1: Blog Posts
Name: Blog Posts
Path: content/posts/**/*.md
# Collection 2: Documentation
Name: Documentation
Path: docs/**/*.mdx
# Collection 3: Pages
Name: Pages
Path: src/pages/*.md
Collection Settings
Advanced Options
File Extension
- Specify
.mdor.mdxor both - Set via path pattern:
**/*.{md,mdx}
Slug Field
- Field used to generate URLs
- Usually
titleorslug - Can be customized per collection
Preview Path
- Template for preview URLs
- Example:
/blog/{slug} - Enables live preview of content
Sort By
- Default field for sorting entries
- Common:
date,title,order - Can be changed in collection view
Sort Order
- Ascending or descending
- Descending for blog posts (newest first)
- Ascending for docs (alphabetical)
Collection Organization Strategies
By Content Type
Organize collections by what they represent:
Posts: content/posts/**/*.md
Pages: content/pages/**/*.md
Docs: docs/**/*.mdx
By Section
For documentation sites:
Getting Started: docs/getting-started/**/*.md
Guides: docs/guides/**/*.md
API Reference: docs/api/**/*.md
By Date
For blogs with date-based structure:
2024 Posts: content/posts/2024/**/*.md
2023 Posts: content/posts/2023/**/*.md
By Status
Separate drafts from published content:
Published: content/posts/**/!(_)*.md
Drafts: content/drafts/**/*.md
Managing Collections
Editing Collections
- Go to Collections settings
- Click the collection to edit
- Update name, path, or description
- Save changes
Note: Changing path patterns may affect which files appear in the collection.
Deleting Collections
- Go to Collections settings
- Click the collection to delete
- Confirm deletion
Important: Deleting a collection does not delete files from your repository—only the collection configuration in md0 CMS.
Reordering Collections
Drag and drop collections in the sidebar to reorder them for easier navigation.
Collection Filters
Filter entries within a collection:
By Frontmatter Field
# Show only published posts
published: true
# Show posts from specific category
category: "Tutorial"
# Show posts by author
author: "Jane Doe"
By Date Range
# Posts from last 30 days
date: last_30_days
# Posts from 2024
date: 2024
Best Practices
Naming Conventions
- Use clear, descriptive collection names
- Pluralize collection names ("Posts" not "Post")
- Match naming to your site's structure
- Be consistent across collections
Path Patterns
- Use
**/*for recursive matching - Be specific to avoid unintended matches
- Test patterns with your repository structure
- Document complex patterns
Collection Structure
- One collection per content type
- Keep schemas focused and minimal
- Use filters instead of many collections
- Consider editor workflows when organizing
Troubleshooting
No Files Appearing
Check:
- Path pattern matches your repository structure
- File extensions match pattern (
.mdvs.mdx) - Files contain valid frontmatter
- Repository connection is active
Solution:
- Verify pattern in repository file browser
- Update path pattern to match actual structure
- Check file encoding and syntax
Wrong Files in Collection
Check:
- Path pattern is too broad
- Multiple collections with overlapping patterns
- Unexpected files in matched directories
Solution:
- Make path pattern more specific
- Use exclusion patterns:
!(**/drafts/**) - Reorganize repository structure
Collection Performance
For large collections (1000+ files):
- Use more specific path patterns
- Split into multiple collections
- Consider archiving old content
- Contact support for optimization help
Next Steps
After creating collections:
- Define Schemas for frontmatter fields
- Configure Patterns for advanced setups
- Start Editing your content
Related Documentation
- Collection Patterns - Advanced pattern techniques
- Schema Configuration - Define frontmatter fields
- GitHub Sync - How collections sync with GitHub