跳转到主要内容
指南

Frontmatter

YAML or JSON metadata at the beginning of a Markdown or MDX file, used to define properties like title, date, and tags.

发表于

定义

YAML or JSON metadata at the beginning of a Markdown or MDX file, used to define properties like title, date, and tags.

Frontmatter is metadata written in YAML, JSON, or TOML format at the top of a content file, separated from the main content by triple dashes.

Example

---
title: "My Article"
description: "A description of the article"
publishedAt: 2026-03-15
authors: ["Author Name"]
tags: ["tutorial", "javascript"]
---

Common Fields

  • title: Content title
  • description: Brief summary
  • publishedAt: Publication date
  • updatedAt: Last modified date
  • authors: Content creators
  • tags: Classification labels
  • draft: Publication status
  • translationKey: Cross-locale identifier

Best Practices

  • Use consistent field names
  • Define schemas for validation
  • Keep it simple and semantic
  • Document your frontmatter conventions