MDX Content Conventions
Frontmatter schemas, draft workflow, and where long code samples belong in content-driven sites.
- mdx
- content
Suggested Cursor path: .cursor/rules/mdx-content.mdc
MDX Content Conventions
For Astro sites using content collections.
Frontmatter
Schemas live in content.config.ts. Required fields must validate at build time — fix schema errors before deploy.
Content vs. code
- Long code samples belong in collection MDX bodies, not in page templates
- Cross-link related entries with stable paths (
/projects/slug,/notes/slug) - Fix obvious typos in published code samples before merge
Adding entries
- Create file in the correct collection folder
- Set
draft: trueuntil ready - Run production build to validate
- Flip
draft: falseand deploy
Do not
- Store raw datasets or generated logs in content folders
- Duplicate site-wide marketing copy that belongs in a central data module