YAML Front Matter


Each entry file may contain front matter in YAML format.

Front matter is used for either setting predefined parameters with which entry will be parsed, or setting your own custom variables.

When present, front matter must be the first thing in file and delimited from the file's content with three consecutive dashes (on their own line):

layout: default.twig
permalink: /sub/section/
<p>entry content</p>

Predefined Variables

Variable Description Default
layout If set, specifies which layout to use. default.twig
tags If set, allows to specify tags attributed to given entry. Tag pages are generated automatically. Entry may belong to more than one tag, use YAML List to specify multiple tags. n/a
skip Whether to skip given entry from site generation. Allows omitting certain entries while still having them in entries folder. false
permalink Allows to set the output path of parsed entry wrt site's main output path. See available permalinks strategies n/a

Custom Variables

Phrozn allows you to define your own data structures within front matter. Once defined they are accessible via this container variable.

Depending on text processor you rely on, the way you access this varies. Here is how to do so within entries in Twig format:

author: Vic Farazdagi
<p>{{ this.author }}</p>

Entry Variables in Layouts

Sometimes it is necessary to refer to variables defined in entries from within the layout. For example, assume that you want to set HTML page title inside some entry (while actual HTML tag for the title is defined in layout).

In this case, special container entry is used in layout:

        <title>{{ entry.title }}</title>

Variable access

All variables defined in config.yml are accessible with this.[VARIABLE_NAME].

Generated on 14 Jan, 2014 using Phrozn 0.5.6.

Fork me on GitHub