Guides
Frontmatter
Nizel extracts a leading frontmatter block before template rendering and Markdown parsing.
Syntax
Use --- delimiters at the very start of the Markdown:
---
title: My Page
description: A description of this page
author: silvandiepen
tags:
- markdown
- parser
---
# My Page
Content starts here.
Extraction
When frontmatter: true (the default), Nizel:
- Detects the leading
---block - Parses the content between delimiters as YAML
- Removes the frontmatter from the Markdown body
- Stores the result in
metaandfrontmatter
Accessing Metadata
const { meta } = await nizel(`
---
title: Hello
count: 42
---
Content.
`);
// meta.title === 'Hello'
// meta.count === 42
Template Variables in Frontmatter
Frontmatter values support template expressions:
---
title: ""
slug: ""
---
Template expressions in frontmatter values are resolved after the YAML is parsed, using the provided variables and data.
Frontmatter values are also available as top-level template variables in the Markdown body. This is useful for legal or policy documents where the same entity names repeat throughout the text:
---
entityName: Henk
documentName: "{{ entityName }} service agreement"
---
#
This agreement is between {{ entityName }} and the customer.
The same values remain available through {{ frontmatter.entityName }} and {{ meta.entityName }}. Explicit data or variables passed to Nizel override same-name frontmatter variables in body templates.
Derived Fields
Nizel can derive fields from the content when they are not in frontmatter:
- title — first heading text
- description — first paragraph text
- excerpt — truncated content summary
Options
| Option | Default | Description |
|---|---|---|
frontmatter | true | Enable frontmatter extraction |