MDConverter
Universal In-Browser Converter
100% Client-Side Private

Markdown Front Matter: YAML Metadata at the Top of a File

By the MDConverter team · Updated · 2 min read

Quick answer

Front matter is a block of metadata at the very top of a Markdown file, written in YAML between two lines of three dashes (---). It holds data about the document — title, date, tags, author, draft status — that site generators (Hugo, Jekyll, Astro, Docusaurus, Eleventy) and note apps (Obsidian Properties) read, while the rest of the file is the content. It is not part of Markdown itself, so plain renderers either hide it or show it as a table.

Syntax

The block must be the first thing in the file — no blank lines or spaces before the opening ---.

Markdown
---
title: "Getting started with Markdown"
date: 2026-10-10
tags: [markdown, tutorial]
draft: false
author:
  name: MDConverter team
---

# Getting started with Markdown

The article content starts here.
Renderers that understand front matter hide the block; GitHub shows it as a small table at the top of the file view.

YAML rules that matter

  • key: value with a space after the colon.
  • Quote strings that contain a colon, #, or start with a special character: title: "Step 1: Install".
  • Lists as [a, b] or one - item per line.
  • Indent with spaces, never tabs, for nested values.
  • Dates in YYYY-MM-DD form are read as dates by most tools.
  • Booleans true/false; beware that some older YAML parsers also treat yes/no as booleans.

Common fields by tool

Tool Typical fields
Hugo title, date, draft, tags, categories, slug, weight
Jekyll layout, title, date, categories, permalink, published
Astro / Eleventy title, description, pubDate, layout, tags (Astro validates them with content-collection schemas)
Docusaurus id, title, sidebar_label, sidebar_position, slug, description
Obsidian (Properties) tags, aliases, cssclasses, plus any custom field
SEO plugins description, image, canonical

Hugo also accepts TOML front matter between +++ lines and JSON in braces.

Front matter outside websites

  • Pandoc reads title, author, date and abstract for the title block of PDFs and Word documents.
  • Obsidian shows front matter as editable Properties and uses tags and aliases for search and links.
  • Prompt and agent files for AI tools increasingly use front matter for settings such as a name and description.

Front matter when converting

When you convert a file that starts with front matter, decide whether the metadata belongs in the output. Markdown to JSON and Markdown to YAML are useful for pulling structured data out of documents, and YAML to Markdown turns a YAML file into readable Markdown documentation. For Word or PDF output, delete the front matter block first so it does not appear as text at the top of the document.

Common mistakes and how to fix them

ProblemFix
Front matter shows as text or a horizontal ruleThe opening --- must be on line 1, with nothing (not even a blank line or BOM) before it.
Build fails with a YAML errorQuote values that contain : or start with [, {, *, &, !, |, >, % or @.
Tags are not recognisedUse a YAML list (tags: [a, b] or one - a per line), not a comma-separated string.
Indentation errorReplace tabs with spaces.

Tools for this

Frequently Asked Questions

Frequently Asked Questions About Front matter (YAML metadata)

Comprehensive answers to common technical, formatting, security, and compatibility questions.

No. It is a convention added by tools such as Jekyll and later adopted by most site generators and note apps. CommonMark does not define it, so a plain renderer treats the opening --- as a horizontal rule unless it supports front matter.

Sources

← All Markdown lessons · Markdown cheat sheet