Skip to content

Frontmatter

How to include YAML frontmatter in your Markdown in an MkDocs site.

Relevant plugin docs

List of tags:

  • mkdocs

  • jinja2

  • examples

Example: Use frontmatter variables in your Markdown

This page has the following frontmatter:

title: Frontmatter
description: How to display YAML frontmatter in an MkDocs site.
docsLink: https://mkdocs-macros-plugin.readthedocs.io/en/latest/pages/#in-the-yaml-header-of-the-page
tags:
  - mkdocs
  - jinja2
  - examples

It then uses that frontmatter to create the title and introduction:

# {{ title }}

{{ description }}

[Relevant plugin docs]({{ docsLink }})

List of tags:
{% for tag in tags %}
* {{ tag }}
{% endfor %}