---
title: 'Type-Safe Content Pipelines with Content Collections'
description: 'How Content Collections bridges frontmatter validation and full MDX support with Zod schemas.'
subtitle: 'From unstructured Markdown to bulletproof TypeScript objects.'
date: '2025-12-10'
lang: 'en'
---

Content management in static sites used to be fragile. Typos in frontmatter keys often went unnoticed until production deployment.

## Enter Content Collections

With :c[Content Collections]{href="https://content-collections.dev"}, schemas are defined with Zod:

```typescript
import { defineCollection, defineConfig } from '@content-collections/core'
import { z } from 'zod'

const posts = defineCollection({
  name: 'posts',
  directory: './content/posts',
  include: '**/*.md',
  schema: z.object({
    title: z.string().min(3),
    date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
    draft: z.boolean().default(false),
  }),
})

export default defineConfig({ content: [posts] })
```

Any invalid post fails during the build phase with actionable error messages and line pointers.
