The YAML module provides two features:
.yml and .yaml files in /.lunet/data/----delimited YAML front matter in content pagesIt depends on the Datas module and uses the SharpYaml library with the extended schema.
Pages can include YAML front matter delimited by ---:
---
title: "Hello"
tags: ["docs", "guide"]
date: 2024-01-15
---
# Hello
This is content.
Front matter must start with an explicit --- delimiter. All key-value pairs become page-level template variables accessible in layouts and includes.
Place data files under /.lunet/data/:
# /.lunet/data/project.yml
name: Lunet
version: "1.0"
Access it in templates:
site.data.project.name
YAML scalar values are automatically typed using SharpYaml's extended schema:
| YAML value | Scriban type | Examples |
|---|---|---|
| Mapping | ScriptObject | key: value |
| Sequence | ScriptArray | [a, b, c] or - item |
| Integer | int or long | 42, 0xFF |
| Float | double | 3.14, .inf |
| Boolean | bool | true, false, yes, no |
| Null | null | null, ~ |
| Timestamp | DateTime | 2024-01-15 |
| String | string | "hello", unquoted text |
Data files with multiple ----separated documents produce a ScriptArray of top-level objects:
---
name: "First"
---
name: "Second"
This becomes a ScriptArray with two ScriptObject elements.
--- — files without this delimiter are treated as having no front matter.site.data container