Front Matter
Any file under site/
may prepend YAML front matter to tweak how that file is rendered. All fields are optional.
---
# The default title is based on the filename
title: My Title
# Override the default layout, or disable the layout with false
layout: home
# If this file isn't ready yet, set to false
published: true
# Arbitrary values will be available on `page` and `files`
my_val: bar
---
<!DOCTYPE html>
<html lang="en">
...
Layouts
Layouts are .liquid
files in layouts/
. The content
variable contains the data to render.
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ page.title }}</title>
</head>
<body>
{{ content }}
</body>
</html>
Layouts can be applied in the YAML front matter of any file under site/
. If the following file is named bar.html*
or bar.md*
, it will look for a layout named foo.html.liquid
:
---
layout: foo
---
My content
Default layouts
If you create a layout named default.<ext>.liquid
, Yass will apply it to any .<ext>
files without a layout. For example, a layout named default.html.liquid
will match foo.html
or foo.md.liquid
.
A file may eschew the default layout by setting layout: false
in the YAML front matter.
Templates
Templates live in templates/
and can be used in any .liquid
files.
templates/greeting.liquid
<p>Hi, my name is {{ name }}</p>
Render the above template with:
{% render "greeting", name: "Pleck" %}
NOTE: Liquid is pretty strict about template filenames. They must match ^[a-zA-Z0-9_]\.liquid$
.