Step by Step Tutorial

3
Step

Front Matter

Front matter is a snippet of YAML placed between two triple-dashed lines at the start of a file.

You can use front matter to set variables for the page:

---
my_number: 5
---

You can call front matter variables in Liquid using the page variable. For example, to output the value of the my_number variable above:

{{ page.my_number }}

Use front matter

Change the <title> on your site to use front matter:

---
title: Home
---
<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>{{ page.title }}</title>
  </head>
  <body>
    <h1>{{ "Hello World!" | downcase }}</h1>
  </body>
</html>

You must include front matter on the page for Rustyll to process any Liquid tags on it.

To make Rustyll process a page without defining variables in the front matter, use:

---
---

Next, you’ll learn more about layouts and why your pages use more source code than plain HTML.