What is the front matter Markdown files often start with?
Bobby Huang ·
Markdown front matter records file metadata before the main text. It usually uses YAML key and value pairs between two lines of three dashes. Fields can record a title, date, status, owner or tags.
Key takeaways
- Front matter holds facts about the file, not the content of it.
- It must be the first thing in the file, between two lines of exactly three dashes.
- The content must be valid YAML. One bad indent or an unquoted colon can break the whole block.
- Keys are case-sensitive. Status and status are two different fields.
Markdown front matter records file metadata before the main text, often a title, date, status or owner.
It sits between two lines of three dashes. Most front matter is written in YAML, a plain format of key: value pairs.
What it looks like
---
title: Q3 vendor review
status: draft
owner: Jane Doe
date: 2026-01-15
tags: [vendors, review]
---
# Q3 vendor review
The body of the note starts here.
Everything between the dashes is front matter. Everything after the closing dashes is the document.
What front matter is for
Front matter holds facts about the file, not the content of it. Common uses:
- Titles and dates. A site builder can use them for page titles and sort order.
- Status. A field like
status: drafttells a person or a script where the file stands. - Ownership.
owner: Jane Doesays who is responsible. - Tags. A list of tags lets tools group related files.
Read the status, date and owner field notes for individual field meanings.
Tools that read front matter turn these fields into data. Tools that don't read it show the block as plain text at the top of the page.
Why agent-written files often have it
AI agents that write Markdown often add a header so other tools can track the file. A report from an agent working for Doe Holdings might carry status, date, and owner on every run. That header changes as the agent rewrites the file, so it is worth reading, not skipping.
Front matter rules in short
- It must be the first thing in the file. Nothing, not even a blank line, goes before the opening dashes.
- The opening and closing lines are exactly three dashes.
- The content must be valid YAML. One bad indent or an unquoted colon can break the whole block.
- Keys are case-sensitive.
Statusandstatusare two different fields.
When one of these rules is broken, many tools give up and show the raw text. See Common YAML front matter errors and how to fix them for the usual causes and fixes.
Related terms
- YAML: the data format most front matter uses.
- TOML front matter: a variant fenced with
+++instead of---. - Metadata: the general term for data about a file. Front matter is one way to store it inside the file itself.
The fence line tells you at a glance whether a header is TOML or YAML.
Reading front matter without the raw YAML
Raw YAML is easy to misread when a file has many fields. A YAML parser or a script can display the fields as rows, with each key beside its value. Use those rows to find the metadata, then check the raw header before changing a value.
Go deeper
For a full walk-through of fields, quoting, and lists, read the pillar guide: YAML front matter in Markdown: a practical guide.