Markdown File Configuration Reference
🕒 Reading time: 2 min📝 Words: 498👀 Views: Loading...
Overview
This article is rewritten according to the current schema (see src/content.config.ts), listing the frontmatter requirements and examples for posts, about, and words. Avoid using project-internal relative links to ensure no broken links when published to the site.
posts/*.md frontmatter
Loader: base is stalux/posts/, pattern *.md/*.mdx.
Required fields:
title: Post title.abbrlink: Permanent link, supports strings or numbers (numbers are automatically converted to strings). It is recommended to manually set this to keep URLs stable.date: Publish time, string type, recommended formatYYYY-MM-DD HH:mm:ss, must be wrapped in double quotes to prevent YAML from automatically converting it to a Date object.
Optional fields:
updated: Update date, string type, same format asdate, also needs double quotes. If not provided, the update time will not be displayed.draft: Boolean, default false; when true, can be used for local draft control.tags: Tag array; a string or single string will be preprocessed into an array.categories: Category array; a string or single string will be preprocessed into an array.cc: Copyright license, defaultCC-BY-NC-SA-4.0.
Example:
---title: Astro Getting Started Guideabbrlink: astro-guidedate: "2025-05-10 09:30:00"updated: "2025-05-12 18:00:00"tags: - Astro - Frontendcategories: - Tech Tutorialcc: CC-BY-NC-SA-4.0draft: false---
Body content...Writing tips:
- Recommended date format:
YYYY-MM-DD HH:mm:ss(e.g.,"2025-05-10 09:30:00"). - Must be wrapped in double quotes, otherwise YAML will automatically convert it to a Date object, causing schema validation to fail.
abbrlinkcan be a string (e.g.,"astro-guide") or a number (e.g.,123456); numbers are automatically converted to strings.tags/categoriessupport a single string or an array; they are automatically converted to arrays internally.- If
ccis not provided, the default valueCC-BY-NC-SA-4.0is used; if no copyright notice is needed, it can be set to an empty string.
about/*.md frontmatter
Loader: base is stalux/about/, pattern **/*.{md,mdx}.
Fields:
titleis required.descriptionis required (used for page description/SEO).
Example:
---title: About the Authordescription: Personal introduction, skills, and contact information---
Here is the about page body...words/*.md frontmatter
Loader: base is stalux/words/, pattern *.md/*.mdx.
All fields are optional:
source: Source or author name.link: Source link; when present,sourcewill render as a clickable external link.sourceDate: The date associated with the source, displayed in italics at the bottom-right of the card.date: The date this quote was written, displayed at the bottom-left of the card and used for sorting; same format as posts’date.updated: Update date, string, same format asdate.draft: Boolean, defaultfalse; whentrue, not displayed.
Example:
---source: "Quake III Arena"link: "https://en.wikipedia.org/wiki/Fast_inverse_square_root"sourceDate: "1999"date: "2026-06-18 20:45:00"updated: "2026-06-18 21:00:00"draft: false---
Talk is cheap. Show me the `code`.Writing and Validation
- Place frontmatter at the top of the file, wrapped in three dashes.
- Leave a space after colons, maintain correct indentation for arrays/objects.
- After saving, run
bun run dev; if any required fields are missing or types don’t match, the build log will indicate the specific fields.
Markdown File Configuration Reference
Author: xingwangzhe
Article link: https://stalux.needhelp.icu/posts/f31dae4f/
This article is licensed under 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议.