Home / Function/ defineCollection() — astro Function Reference

defineCollection() — astro Function Reference

Architecture documentation for the defineCollection() function in runtime.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  a4b0e300_315a_a3fe_a617_8c6cbf962195["defineCollection()"]
  73d13646_8e80_972f_3adc_f28448b64e4d["runtime.ts"]
  a4b0e300_315a_a3fe_a617_8c6cbf962195 -->|defined in| 73d13646_8e80_972f_3adc_f28448b64e4d
  style a4b0e300_315a_a3fe_a617_8c6cbf962195 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/runtime.ts lines 706–716

export function defineCollection(config: any) {
	if (config.type === 'live') {
		throw new AstroError({
			...AstroErrorData.LiveContentConfigError,
			message: AstroErrorData.LiveContentConfigError.message(
				'Collections with type `live` must be defined in a `src/live.config.ts` file.',
			),
		});
	}
	return defineCollectionOrig(config);
}

Subdomains

Frequently Asked Questions

What does defineCollection() do?
defineCollection() is a function in the astro codebase, defined in packages/astro/src/content/runtime.ts.
Where is defineCollection() defined?
defineCollection() is defined in packages/astro/src/content/runtime.ts at line 706.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free