Skip to content
Air
zh

Using MDX

Guides· 1 min read

Updated

Last modified

MDX is Markdown that can include components. The @astrojs/mdx integration is enabled in astro.config.mjs, and the blog collection loads both .md and .mdx files.

Write a post

  1. Add a file under src/content/blog/<locale>.
  2. Fill in title, description, and pubDate.
  3. Import a component when the post needs more than Markdown.

Stay with the paragraph until one sentence feels heavier than the rest. That is the one worth keeping. The others can wait until you know why you marked this page.

Write enough that tomorrow’s you can find the spot without rereading the whole chapter. A name, a page, and the question you had not answered yet are usually enough.

Frontmatter

title is the heading. description is the summary shown in lists. pubDate sets the order.

Stay with the paragraph until one sentence feels heavier than the rest. That is the one worth keeping. The others can wait until you know why you marked this page.

Write enough that tomorrow’s you can find the spot without rereading the whole chapter. A name, a page, and the question you had not answered yet are usually enough.