Astro Content Collections
Manage type-safe content collections in Astro with schema validation and query APIs.
Overview
Agents can set up content collections for blogs, documentation, products, and other content types with proper schema validation. They can generate content entries with valid frontmatter, create dynamic routes from collections, and query content using Astro's built-in APIs.
Content Collections support Markdown, MDX, JSON, and YAML formats with automatic type inference. Teams can use AI agents to maintain strict content standards, generate content from templates, and ensure all entries conform to the defined schema.
Who Is This For?
- Define Zod schemas for content collections
- Generate content entries with valid frontmatter
- Create dynamic routes from content collections
- Migrate existing content to Astro Content Collections
Installation
npx astro add mdx Configuration
// src/content/config.ts
import { defineCollection, z } from 'astro:content';
const blog = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
description: z.string(),
pubDate: z.coerce.date(),
tags: z.array(z.string()).default([]),
draft: z.boolean().default(false),
}),
});
export const collections = { blog }; Explore AI Tools
Discover the best AI tools that complement your skills
Read AI & Design Articles
Tips and trends in the world of design and AI
Related Servers
Markdown Documentation Generator
Auto-generate structured project documentation from your codebase. AI agents can produce API references, guides, and architecture docs.
OpenAPI Documentation
Generate interactive API documentation from OpenAPI and Swagger specifications. Keep your API docs always up to date with your endpoints.
README Generator
Create comprehensive, well-structured project READMEs that cover installation, usage, configuration, and contribution guidelines.