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.
With tags and description
Common fields used by blogs and static sites.
Platform support
| Platform | Supported | Notes |
|---|---|---|
| Obsidian | Yes | Native Properties panel built on frontmatter |
| GitHub | Partial | Rendered as a table, not hidden as metadata |
| Jekyll | Yes | Core feature of Jekyll |
| Hugo | Yes | — |
| Astro | Yes | — |
| Discord | No | Rendered as code block |
Common mistakes
Frontmatter in the middle of the file
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.
--- (TOML +++)
--- (YAML ---)
Hugo also supports TOML (+++) and JSON frontmatter. Make sure you use the right delimiter for your parser.
Tips for yaml frontmatter
YAML tags: [markdown, seo] is the inline array format. You can also use block format: tags: - markdown - seo
Use ISO 8601 date format (YYYY-MM-DD) for maximum compatibility across static site generators.
Frequently asked questions
Everything you need to know.
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
Comment
Markdown doesn't have its own comment syntax. To add hidden comments that won't appear in the rendered output, use HTML comments (<!-- -->). These are useful for notes to collaborators, TODOs, and temporary content.
Heading
Markdown headings are created with hash symbols (#). One hash for H1 (largest), two for H2, up to six for H6 (smallest). Headings structure your document and create a hierarchy that readers and search engines can follow.
HTML Block
Most markdown parsers allow you to embed raw HTML directly in your markdown file. HTML blocks let you use elements not supported by markdown — custom divs, details/summary, colored text, form elements, and more. HTML support depends on the platform — some sanitize or strip it entirely.
Try it in the editor
Paste your markdown and see yaml frontmatter rendered instantly with professional themes.