Skip to content
uencoder

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
    ---
    # Body
    Output
    meta {title:"Hello"} + body

    YAML frontmatter

Common errors

A frontmatter syntax error breaks parsing
Check it with a validator for the corresponding format

Related terms

References