Book a call Free rebuild
Home/Glossary/Astro/Content Collections

Content Collections

By Seahawk November 16, 2026

Astro glossaryContent collections are Astro's way of managing sets of content, such as posts or docs, with a loader, a schema, and type-safe queries.

A content collection is a set of entries with the same structure, such as blog posts, docs pages, or products, that Astro loads, validates, and lets you query. Each collection has a loader, which says where the entries come from, and an optional schema, which says what fields they must have.

How it works

  • Loaders: glob() reads Markdown, MDX, JSON, or YAML files from a folder, file() reads many entries from one file, and custom loaders pull from an API or a CMS.
  • Schemas are written with Zod. Astro checks every entry against them at build time and generates TypeScript types, so a missing field is a build error, not a broken page.
  • Pages query with getCollection() and getEntry().

These build-time collections are saved when the site builds. For content that changes between builds, Astro has live collections.

Source: Astro docs: Content collections.

Em Workers

EmDash and Astro sites at revolutionary pricing.

Lightning-fast, secure websites delivered on EmDash and Astro. For the AI-curious bunch.