본문으로 건너뛰기
← Blog
1 min read

Astro Content Collections

How I organize MDX with content collections

astro, mdx, content

Astro Content Collections

Using typed schemas keeps content safer and easier to query.

import { defineCollection, z } from 'astro:content';

const blog = defineCollection({
  type: 'content',
  schema: z.object({
    title: z.string(),
    description: z.string(),
    date: z.date(),
    tags: z.array(z.string()),
  }),
});

export const collections = { blog };