Data
Data sources
Files in data/ are loaded automatically and accessible via {{ global.* }}.
Supported formats : YAML, JSON, PHP, XML, INI, Markdown.
data/site.yml :
name: My Site
tagline: Great static site
{
"name": "My Site",
"tagline": "Great static site"
}
<?php
return [
'name' => 'My Site',
'tagline' => 'Great static site',
];
<?xml version="1.0"?>
<root>
<name>My Site</name>
<tagline>Great static site</tagline>
</root>
name = My Site
tagline = Great static site
Caching
Every data source is transformed into a PHP file and cached in
/tmp/kiss/<hash>/datatree/.
How it works :
- A
.yml,.json,.xml,.ini,.mdor.phpfile is loaded - The appropriate loader parses it (YamlLoader, JsonLoader, etc.)
- The result is serialized as a PHP file via
var_export()and stored - On subsequent builds, the cached PHP is included — no parsing needed
- When the source file changes, the cache is invalidated
Same mechanism for $ref and remote files :
items:
$ref: https://api.example.com/posts.json
URLs are fetched once, cached as PHP, and served from cache on rebuilds until the resource changes.
Cache invalidation :
kiss reset cacheremoves all cached filesDataTree::invalidate(source)removes a single entry- Automatic when the source file's CRC32C changes
Markdown
---
title: My Article
date: 2024-01-01
---
Content **markdown** here.
Frontmatter fields are available directly, body as content :
<h1>{{ title }}</h1>
<div>{{ content|markdown|raw }}</div>