Classes
CollectionConfig
9
▼
Configuration for a content collection.
Defines how content in a directory (or remote source) maps…
CollectionConfig
9
▼
Configuration for a content collection.
Defines how content in a directory (or remote source) maps to a typed
schema. Created viadefine_collection() rather than direct instantiation.
Type Parameters: T: The schema type (dataclass or Pydantic model)
Attributes
| Name | Type | Description |
|---|---|---|
schema |
type[T]
|
Dataclass or Pydantic model class defining the frontmatter structure. Required fields in the schema become required frontmatter. |
directory |
Path | None
|
Directory containing collection content, relative to content root. Required for local content; optional when using |
glob |
str
|
Glob pattern for matching content files within the directory. Defaults to |
strict |
bool
|
If |
allow_extra |
bool
|
If |
loader |
ContentSource | None
|
Optional :class: |
Methods
is_remote
0
bool
▼
Whether this collection fetches content from a remote source.
property
is_remote
0
bool
▼
def is_remote(self) -> bool
Returns
bool
``True`` if a loader is configured; ``False`` for local content.
source_type
0
str
▼
The content source type identifier.
property
source_type
0
str
▼
def source_type(self) -> str
Returns
str
Source type string: ``'local'`` for filesystem content, or the
loader's ``source_type`` (e.g., ``'github'``, ``'notion'``).
Internal Methods 1 ▼
__post_init__
0
▼
Validate configuration and normalize the directory path.
__post_init__
0
▼
def __post_init__(self) -> None
Functions
define_collection
6
CollectionConfig[T]
▼
Define a content collection with a typed schema.
Collections provide type-safe…
define_collection
6
CollectionConfig[T]
▼
def define_collection(schema: type[T], directory: str | Path | None = None, *, glob: str = '**/*.md', strict: bool = True, allow_extra: bool = False, loader: ContentSource | None = None) -> CollectionConfig[T]
Define a content collection with a typed schema.
Collections provide type-safe frontmatter validation during content discovery. Errors are caught early, and IDEs provide autocompletion for frontmatter fields.
Parameters
| Name | Type | Description |
|---|---|---|
schema |
type[T] |
Dataclass or Pydantic model class defining the frontmatter structure. Fields without defaults are required; fields with defaults (or |
directory |
str | Path | None |
Directory containing collection content, relative to the content root. Required for local content; omit when using None
|
glob |
str |
Glob pattern for matching content files. Defaults to '**/*.md'
|
strict |
bool |
If True
|
allow_extra |
bool |
If False
|
loader |
ContentSource | None |
Optional :class: None
|
Returns
CollectionConfig[T]