Skip to content
All referenceStructure

Markdown YAML Frontmatter

How to add YAML frontmatter to markdown files for metadata like title, date, and tags. Used by static site generators, Obsidian, and Jekyll.

What is markdown yaml frontmatter?

YAML frontmatter is a block of YAML metadata placed at the very top of a markdown file, between two sets of triple dashes (---). It stores structured data about the document — title, date, author, tags, layout — separate from the content. Static site generators like Jekyll, Hugo, and Astro use frontmatter to control page rendering.

Syntax

Basic frontmatter

The YAML block between --- markers. Everything in this block is metadata, not page content.

Result
(Metadata — not rendered in body)

With tags and description

Common fields used by blogs and static sites.

Result
(Metadata)

Platform support

PlatformSupportedNotes
ObsidianYesNative Properties panel built on frontmatter
GitHubPartialRendered as a table, not hidden as metadata
JekyllYesCore feature of Jekyll
HugoYes
AstroYes
DiscordNoRendered as code block

Common mistakes

Wrong
Frontmatter in the middle of the file
Right
Frontmatter must be at the very top of the file

YAML frontmatter is only recognized at the start of the document (line 1). It will not be parsed as metadata if placed elsewhere.

Wrong
--- (TOML +++)
Right
--- (YAML ---)

Hugo also supports TOML (+++) and JSON frontmatter. Make sure you use the right delimiter for your parser.

Tips for yaml frontmatter

1Indent arrays correctly

YAML tags: [markdown, seo] is the inline array format. You can also use block format: tags: - markdown - seo

2Date format matters

Use ISO 8601 date format (YYYY-MM-DD) for maximum compatibility across static site generators.

Frequently asked questions

Everything you need to know.

1

What is frontmatter in markdown?

Frontmatter is a block of YAML metadata at the top of a markdown file, between --- delimiters. It stores structured data like title, date, and tags that processors use to generate pages, feeds, and metadata.

Related elements

Try it in the editor

Paste your markdown and see yaml frontmatter rendered instantly with professional themes.