Expand description
Typed content collections with frontmatter schema validation.
§Typed content collections with frontmatter schema validation
Defines content schemas in content.schema.toml and validates
every Markdown file’s frontmatter against the matching schema
before compilation begins.
§Schema file format
[[schemas]]
name = "post"
[[schemas.fields]]
name = "title"
type = "string"
required = true
[[schemas.fields]]
name = "date"
type = "date"
required = true
[[schemas.fields]]
name = "draft"
type = "bool"
required = false
default = "false"§Supported field types
string, date, bool, integer, float, list,
enum(value1,value2,...).
Structs§
- Content
Schema - A named collection of field definitions.
- Content
Validation Plugin - Plugin that validates content frontmatter against schemas defined in
content.schema.tomlduring thebefore_compilehook. - Field
Def - Definition of a single frontmatter field.
- Validation
Error - A single validation error with file context.
Enums§
- Field
Type - The type of a frontmatter field.
Functions§
- load_
schemas - Loads all content schemas from a
content.schema.tomlfile. - parse_
schemas - Parses the TOML text of a schema file into
ContentSchemavalues. - validate_
content_ dir - Validates every
.mdfile incontent_diragainst the loaded schemas. - validate_
frontmatter - Validates a frontmatter map against a
ContentSchema. - validate_
only - Runs content schema validation without building the site.
- validate_
with_ schema - Validates every
.mdfile undercontent_diragainst the schema atschema_path.