Frontmatter
Frontmatter is a YAML/TOML/JSON metadata block placed at the top of a document, delimited by ---, commonly used by static site generators.
Purpose
To attach structured metadata before the body of a Markdown-like document, easing site generation and content management.
Mechanism
The document starts with ---, followed by YAML (or TOML/JSON) metadata, ends with ---, and the body follows. The parser separates frontmatter from the body. Jekyll, Hugo, and Astro use it widely.
Use cases
- Astro/Hugo/Jekyll article metadata
- Markdown blog frontmatter
- Documentation site configuration
- CMS content management
Examples
- Input
--- title: Hello --- # BodyOutputmeta {title:"Hello"} + bodyYAML frontmatter
Common errors
- A frontmatter syntax error breaks parsing
- Check it with a validator for the corresponding format
Related terms
YAML
YAML (YAML Ain't Markup Language) is a configuration-oriented data serialization format using indentation for hierarchy, supporting comments and references, and better suited to hand editing than JSON. GLOSSARY
TOML
TOML (Tom's Obvious, Minimal Language) is a configuration-oriented format representing data with tables and key-value pairs, with explicit semantics and no implicit type inference. GLOSSARY
JSON
JSON (JavaScript Object Notation) is a lightweight data interchange format based on JavaScript object literals, using key-value pairs and arrays. GLOSSARY
YAML Frontmatter
YAML frontmatter is the --- delimited YAML block at the top of a Markdown file that stores document metadata (title, date, tags). GLOSSARY