Skip to content
Gx
GitHub

GX8002: component is not declared in this collection

A content file uses a component tag that is not in the Components list of its collection.

Cause

A content file uses a component tag that is not in the Components list of its collection.

Example

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

# Start

<site.Note>Read this first.</site.Note>
site/Note.gx
package site

props {
  Children gx.Node
}

<aside>{p.Children}</aside>
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:7:1: GX8002: component "Note" is not declared in this collection

Fix

  1. Add the component to the Components call of the collection.
  2. Or remove the tag from the content file.