Content Collections
How it works
Every template uses Astro Content Collections to manage structured content. Each collection is a folder of markdown files with typed frontmatter.
- Add a file → it appears on the site automatically
- Delete a file → it disappears
- Edit frontmatter → the data updates everywhere it’s used
- No routing changes, no config changes
File format
Each content item is a .md file with YAML frontmatter:
---
name: "Item Name"
description: "A short description."
price: 25
category: "mains"
order: 10
available: true
---
Optional body text (full markdown supported).
Collections by vertical
Restaurant templates
Menu (src/content/menu/)
| Field | Type | Required | Notes |
|---|---|---|---|
name |
string | yes | Item name |
description |
string | yes | One-liner shown on the menu |
price |
number | yes | Numeric, no currency symbol |
currency |
string | no | Default: "USD" |
category |
enum | yes | starters · mains · desserts · drinks |
tags |
string[] | no | vegetarian · vegan · gluten-free · spicy |
order |
number | no | Sort within category (lower = first) |
available |
boolean | no | false hides the item |
featured |
boolean | no | true shows it on the homepage |
FAQ (src/content/faq/)
| Field | Type | Required |
|---|---|---|
question |
string | yes |
answer |
string | yes |
order |
number | no |
FAQs generate schema.org FAQPage markup automatically.
Legal (src/content/legal/)
| Field | Type | Required |
|---|---|---|
title |
string | yes |
updated |
string | yes |
Body is full markdown. Replace the demo text with your own privacy policy and terms.
Naming convention
Filenames should be kebab-case and describe the content: grilled-salmon.md, walk-ins.md.
Validation
Frontmatter is validated at build time with Zod schemas defined in src/content.config.ts. If a required field is missing or has the wrong type, npm run build will tell you exactly what’s wrong.