Front Matter
Files can start with YAML front matter between --- delimiters. It serves two roles:
- Document metadata — injected as template variables at render start
- Component prop contracts — type, required flag, and defaults (see Includes and components)
Document metadata
---
title: About us
author: Team
---
# {{ title }}
Written by {{ author }}.
By default, front matter is stripped from output. Set preserveFrontMatter: true in render options to keep it.
Size limit
Front matter source must be ≤ 64 KB. Larger files throw frontmatter_too_large.
Component props contract
Define props in a component file's front matter:
---
props:
name:
type: string
isRequired: true
default: "Guest"
count:
type: number
---
| Field | Meaning |
|---|---|
type | string, number, boolean, object, or array |
isRequired | When true, missing props emit prop_missing warning |
default | Value used when the prop is not passed |
Omitting type infers from the default value or passed value.
Scoping
Later bindings override earlier ones with the same name:
- API
context - File front matter
@hgdeclarations- Component call props (inside the component)
Component as aliases are an exception — they cannot collide. See Includes and components.
Security note
Do not store secrets in front matter. Use serverContext on the server instead. See Paths and security.