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

Front matter is a block of YAML at the very top of a Markdown file, opened and closed by a line of three dashes (---). Static site generators read it as the page's data, such as title, date, layout and tags, then render everything below the closing line as the page content.

Front matter support in four popular static site generators
GeneratorFormatsFields it reads itself
JekyllYAML between ---layout, permalink, published; on posts: date, category, categories, tags
HugoYAML (---), TOML (+++), JSON ({ })title, date, draft, description, slug, weight, tags
EleventyYAML by default, plus ---json and ---jspermalink, layout, tags
AstroYAML or TOMLlayout (for Markdown pages in src/pages)

Updated

Front matter turns a plain Markdown file into a page with metadata, and a single misplaced dash breaks it. Paste a file into the splitter to see exactly where the metadata ends and the content starts, and which top-level fields it found, before your build complains.

Front matter splitter

Paste a Markdown file. The splitter finds the front matter block, lists its simple top-level fields and shows the body that will be rendered.

Front matter found and closed.

Front matter examples

A blog post (YAML)

A typical post: quoted title because it contains a colon, a date, a list of tags and a custom author field.

---
title: "Sourdough: a beginner's starter"
description: Feed it daily for a week before baking.
date: 2026-10-20
tags:
  - baking
  - guides
author: Ana Ruiz
---

Mix equal weights of flour and water in a clean jar...

The same post with TOML front matter (Hugo)

Hugo reads +++ as TOML front matter. Custom values sit under the params key.

+++
title = "Sourdough: a beginner's starter"
date = 2026-10-20
draft = false
tags = ["baking", "guides"]
[params]
author = "Ana Ruiz"
+++

Mix equal weights of flour and water in a clean jar...

The delimiter rules

Jekyll's documentation puts it plainly: front matter must be the first thing in the file and must be valid YAML set between triple-dashed lines. Other generators follow the same shape.

Inside the block, normal YAML applies. Indent with spaces, quote values with special characters and use lists for tags and categories.

Fields worth setting on every page

A title and a description cover the page heading and the search snippet in most themes. A date orders posts, and draft or published decides whether the page is built at all.

Everything else is up to your templates. Any field you add becomes data the layout can print, such as an author name, a hero image path or a reading time.

How it works

  1. Paste a Markdown file, or edit the sample post.
  2. The splitter checks that the very first line is --- (YAML) or +++ (TOML) and looks for the matching closing line.
  3. It shows the front matter block, the simple top-level fields it found and the body that will be rendered.
  4. If the block is never closed, it tells you, which is the most common cause of a page rendering its metadata as text.

Tips

Frequently asked questions

What is front matter in Markdown?

It is metadata written at the top of a Markdown file between two delimiter lines. Markdown itself does not define it; static site generators and content tools agreed on the convention and read it as data before rendering the rest.

Does front matter have to be YAML?

YAML is the common default, but not the only option. Hugo accepts TOML between +++ lines and JSON in braces, Eleventy supports ---json and ---js, and Astro accepts TOML as well.

Why does my page show the front matter as text?

Usually something sits before the first ---, the closing --- is missing, or the opening line has extra characters. The splitter above flags the last two straight away.

Can front matter be empty?

Yes. In Jekyll an empty pair of --- lines still marks the file for processing, which is how CSS or feed files get Liquid tags rendered without any metadata.

How do I read front matter in my own code?

Split the file at the delimiters, parse the first part with a YAML library and pass the rest to your Markdown renderer. Eleventy does this with the gray-matter package, which you can also use directly in Node.

Related: Markdown cheat sheet, Static site generators, YAML comments, TOML vs YAML, Markdown to HTML.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Guides

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap