Home Documentation Templates Examples Showcase GitHub
Theme

Content · Validation

Schemas.

Native .schema files give tracked content a small, readable content model while reusing Nift's existing value and validation concepts.

Define a schema

@schema(post) {
    title: string
    draft: bool = false
    tags: taxonomy(tag)[]
}

A schema file may contain multiple declarations. Configure sources explicitly in .nift/config.json; Nift does not magic-scan directories.

"schemas": ["model/content.schema"]

Fields support scalar types, arrays, optional fields with ?, defaults with =, and taxonomy references. Effective front matter is validated before typed content enters the project content index.

Assign a content type

Use conventional front matter:

---
type: post
title: Hello
tags:
  - nift
---

or set "type": "post" on the file entry in .nift/tracked.json. If both specify a type they must agree.

Inspect schemas

$[project.schemas.post.name]
$[(project.schemas).keys()]
nift eval --json 'project.schemas.post'