layout | title | prev_section | next_section |
---|---|---|---|
docs |
Front-matter |
configuration |
posts |
The front-matter is where Jekyll starts to get really cool. Any file that contains a YAML front matter block will be processed by Jekyll as a special file. The front matter must be the first thing in the file and must take the form of valid YAML set between triple-dashed lines. Here is a basic example:
{% endhighlight %}
Between these triple-dashed lines, you can set predefined variables (see below for a reference) or even create custom ones of your own. These variables will then be available to you to access using Liquid tags both further down in the file and also in any layouts or includes that the page or post in question relies on.
If you use UTF-8 encoding, make sure that no BOM
header
characters exist in your files or very, very bad things will happen to
Jekyll. This is especially relevant if you’re running Jekyll on Windows.
There are a number of predefined global variables that you can set in the front-matter of a page or post.
Variable | Description |
---|---|
|
|
Any variables in the front matter that are not predefined are mixed into the data that is sent to the Liquid templating engine during the conversion. For instance, if you set a title, you can use that in your layout to set the page title:
{% highlight html %}
<title>{% raw %}{{ page.title }}{% endraw %}</title> ... {% endhighlight %}These are available out-of-the-box to be used in the front-matter for a post.
Variable | Description |
---|---|
|
A date here overrides the date from the name of the post. This can be used to ensure correct sorting of posts. |