Content for Astros
Astro content collections are a typed way to manage groups of Markdown, MDX or data files such as blog posts. A collection defines a schema with Zod, so frontmatter is validated at build time, and you query entries with helper functions to list, filter and render them in pages.
Stage: Basics · Part of the Astro roadmap · Last reviewed 19 November 2026
What to learn in Content
- Define a collection and its Zod schema in the content config
- Query entries with getCollection and filter drafts
- Generate a page for each entry using dynamic routes
- Render the Markdown body of an entry in a template
- Reference one collection from another, such as author from post
Content interview questions
Why use content collections instead of reading Markdown files directly?
Collections give you a validated schema, so a missing title or wrong date type fails the build with a clear error. They also provide typed queries and editor autocompletion. Reading files by hand gives none of this and is easy to break when content changes.
What does getStaticPaths do?
In a static build, a dynamic route needs to know which pages exist. getStaticPaths returns a list of parameter objects, one for each page to generate, along with optional props. For a blog it typically maps each collection entry to a slug.
Where Content fits in the Astro roadmap
Content belongs to the Basics stage (beginner level), which takes about 13 hours. Pages and components.
Other units in this stage
Back to the full Astro roadmap