Frontmatter

Frontmatter is YAML at the top of a file that defines page metadata.

Basic Syntax

Frontmatter is enclosed between two lines of three dashes. Example:

layout: _layouts._main.html
title: Page Title
description: Page description for SEO

Place this YAML between --- delimiters at the very top of your file, then add your content below.

Built-in Properties

PropertyDescription
layoutTemplate to wrap the content
titlePage title (used in templates)
descriptionMeta description
cleanurlIf true, page.htmlpage/index.html

Custom Properties

Add any properties you need:

layout: _layouts._post.html
title: My Post
date: 2024-01-15
author: Jane Doe
tags:
  - javascript
  - tutorial

Access them in templates:

<time>{{ meta.date }}</time>
<span>By {{ meta.author }}</span>
{% for tag in meta.tags %}
  <span class="tag">{{ tag }}</span>
{% endfor %}

Accessing in Templates

All frontmatter is available under meta:

<title>{{ meta.title }}</title>
<meta name="description" content="{{ meta.description }}">