Skip to content
Gx
GitHub

GX8001: frontmatter is malformed or unknown

The frontmatter of a content file has an error.

Cause

The frontmatter of a content file has one of three errors. It is not valid YAML. A value has the wrong type. A key is not a field of the Meta type of the collection.

Example

content/docs/start.md
---
title: Start
author: Ada
---

# Start
site/site.go
package site

import "github.com/alternayte/gx"

// Meta is the frontmatter of one page.
type Meta struct {
	Title string `yaml:"title"`
}

// Docs is the docs collection.
var Docs = gx.Collection[Meta]("content/docs")

gx check reports:

gx check
content/docs/start.md:3:1: GX8001: frontmatter: unknown field "author"

Fix

  1. Correct or remove the key that the message names.
  2. Or add the field to the Meta type.