Sep 29, 2025
First, create a new folder under the src/content/blog/ directory. You can create it directly within this directory or nest it within subdirectories.
For example, create a folder named src/content/blog/my-first-post/, or create src/content/blog/posts/my-first-post/ within a subdirectory. Your article will be published to the corresponding route based on the file’s relative path (relative to src/content/), such as /blog/my-first-post.
For internationalization, use <language>.md naming conventions to distinguish articles in different languages. For example, src/content/blog/my-first-post/zh-cn.md and src/content/blog/my-first-post/en.md represent the Chinese and English versions of an article, respectively.
astro.config.mjs.Each article requires a metadata section (frontmatter) using YAML format, enclosed by --- as shown below:
---
title: Article Title
pubDate: 2025-01-01
description: Brief article description
image: ""
draft: false
slugId: intro/publish
---
| Name | Function |
|---|---|
title | Article title |
pubDate | Publication date, formatted as YYYY-MM-DD |
description | Article description |
image | Cover image, using relative paths relative to the current file, e.g., ./images/cover.png |
draft | Draft status; articles in draft mode won’t appear on the blog homepage when published |
slugId | Article ID, used for generating routes. Each article must be unique. It is recommended to use article paths, such as intro/publish. |
Article content can be written using Markdown format, supporting specific syntax. Refer to other sample articles for details.
For example, the About page is stored in the src/content/spec/about/ folder. Similar to articles, it supports multiple languages and is written in Markdown. It will be rendered according to Markdown formatting and published to the /about route.