File: front-matter.md

package info (click to toggle)
staticsite 2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 14,648 kB
  • sloc: javascript: 33,722; python: 9,851; makefile: 46; sh: 4
file content (51 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Front matter

Front matter in staticsite[^1] is arbitrary key/value data stored in
[JSON](https://en.wikipedia.org/wiki/JSON),
[YAML](https://en.wikipedia.org/wiki/YAML), or
[toml](https://en.wikipedia.org/wiki/TOML) format.

It is the way used to add metadata in [markdown](markdown.md),
[data](data.md), and [jinja2](jinja2.md) pages.

If metadata starts with `---`, it is read as YAML. If it starts with `+++` it
is read as TOML. If it starts with `{`, it is read as JSON.

For documentation on possible metadata contents, see [Common page metadata](metadata.md)

## Example YAML front matter in a markdown page

```yaml
---
title: Page with metadata in YAML format
---
page contents
```

## Example JSON front matter in a Jinja2 page

```jinja2
{% block front_matter %}
{
    "title": "Page with metadata in JSON format"
}
{% endblock %}

{% block content %}
...
{% endblock %}
```

## Example TOML data page

```toml
+++
title = "Page with metadata in TOML format"
```


[^1]:
Inspired from [Hugo front matter](https://gohugo.io/content/front-matter/)


[Back to reference index](README.md)