Astro Content Collections explained
How blog posts and standalone pages are typed, validated, and routed in this template.
This site doesn’t store posts in a database. They’re Markdown files with a Zod schema — Astro Content Collections handle loading, validation, and types.
Two collections
| Collection | Location | Routes to |
|---|---|---|
blog |
src/content/blog/ |
/blog/<slug>/ |
pages |
src/content/pages/ |
/<slug>/ |
Blog posts require title, description, pubDate, and optional tags and draft. Standalone pages only need title and an optional description.
The schema lives in one file
src/content.config.ts defines both collections. When you add a field — say author on blog posts — update the schema, then add the field to frontmatter. astro check catches mismatches immediately.
Drafts stay private
Set draft: true while you’re iterating. Production builds filter drafts out of listings and routes. Flip to false when you’re ready to publish.
Ask Claude to extend it
Add an optional
authorfield to blog posts and show it on the post page.
Claude can update the schema, frontmatter on existing posts, and the blog/[slug].astro template in one pass. That’s the payoff of collections + AI editing: structure stays strict, changes stay fast.