Astro Content Collections Notes
Working notes on Astro Content Collections patterns and gotchas.
Astro Content Collections provide type-safe content management. Define a schema with Zod, and Astro validates all frontmatter at build time.
Key points
- Use
src/content.config.tsfor collection definitions defineCollectionwithglob()loader for file-based content- Schema validation happens at build time, catching frontmatter errors early
getCollection()returns typed entries in.astrofiles- Draft filtering must be explicit in route code