astro · Astro Docs
Content collections
Teaches how to use Astro Content Collections to organize, validate, and type-safe manage local Markdown or MDX content files using Zod schemas.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Content collections
Teaches how to use Astro Content Collections to organize, validate, and type-safe manage local Markdown or MDX content files using Zod schemas.
When To Use
Use when you need to implement type-safe content management for Markdown or MDX files in an Astro project using Zod for schema validation.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/collections-workflow-guide.md | A guide explaining how to manage structured content sets like blog posts and product descriptions using Astro content collections. | Questions about a guide explaining how to manage structured content sets like blog posts and product descriptions using Astro content... |
examples/collections-astro-collections-config.text | A configuration example for defining content collection schemas in an Astro project. | Exact payloads, commands, or snippets shown in A configuration example for defining content collection schemas in an Astro project. |
examples/collections-astro-collections-definecollection-zod.text | A code example demonstrating how to use defineCollection with loaders and Zod schemas to configure content collections in Astro. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use defineCollection with loaders and Zod schemas to configure content collection... |
examples/collections-astro-collections-definecollection-glob-loader.text | A TypeScript code example demonstrating how to define a content collection using the glob loader in Astro. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to define a content collection using the glob loader in Astro. |
examples/collections-astro-collections-markdown-frontmatter.text | A markdown file demonstrating the use of frontmatter properties like title and slug within Astro content collections. | Exact payloads, commands, or snippets shown in A markdown file demonstrating the use of frontmatter properties like title and slug within Astro content collections. |
examples/collections-astro-collections-frontmatter.text | A text example demonstrating frontmatter configuration for content collection entries including title, slug, and description fields. | Exact payloads, commands, or snippets shown in A text example demonstrating frontmatter configuration for content collection entries including title, slug, and desc... |
examples/collections-astro-collections-definecollection-loader-glob.text | A code example demonstrating how to use the defineCollection function with a glob loader to retrieve JSON files in an Astro content collection. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use the defineCollection function with a glob loader to retrieve JSON files in an... |
examples/collections-astro-collections-definecollection-loader.text | A code example demonstrating how to use defineCollection with a file loader to set up content collections in Astro. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use defineCollection with a file loader to set up content collections in Astro. |
examples/collections-astro-collections-id-property.text | An example demonstrating how to specify an id property within an array of objects for Astro content collections. | Exact payloads, commands, or snippets shown in An example demonstrating how to specify an id property within an array of objects for Astro content collections. |
examples/collections-astro-collections-config-2.text | A text example demonstrating the configuration of a content collection schema using object definitions for dog breeds. | Exact payloads, commands, or snippets shown in A text example demonstrating the configuration of a content collection schema using object definitions for dog breeds. |
examples/collections-astro-collections-definecollection-csv-loader.text | An example demonstrating how to use the defineCollection function with a CSV file loader in Astro content collections. | Exact payloads, commands, or snippets shown in An example demonstrating how to use the defineCollection function with a CSV file loader in Astro content collections. |
examples/collections-astro-collections-config-3.text | A text representation of a content collections configuration object showing schema definitions for dogs and cats. | Exact payloads, commands, or snippets shown in A text representation of a content collections configuration object showing schema definitions for dogs and cats. |
examples/collections-astro-collections-definecollection-loader-2.text | A code example demonstrating how to use the defineCollection function with the file loader and a custom parser in Astro content collections. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use the defineCollection function with the file loader and a custom parser in Ast... |
examples/collections-astro-collections-definecollection-loader-3.text | A code example demonstrating how to use the defineCollection function with a custom loader in Astro content collections. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use the defineCollection function with a custom loader in Astro content collections. |
examples/collections-astro-collections-definecollection-zod-2.text | A code example demonstrating how to use defineCollection with glob and file loaders and Zod schema validation in Astro. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use defineCollection with glob and file loaders and Zod schema validation in Astro. |
examples/collections-astro-collections-definecollection.text | A code example demonstrating how to use defineCollection and Zod schemas to configure content collections in Astro. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use defineCollection and Zod schemas to configure content collections in Astro. |
examples/collections-astro-collections-markdown-frontmatter-2.text | A markdown file demonstrating frontmatter structure and local file references within Astro content collections. | Exact payloads, commands, or snippets shown in A markdown file demonstrating frontmatter structure and local file references within Astro content collections. |
examples/collections-astro-collections-getcollection-getentry-javascript.text | A code snippet demonstrating how to use getCollection and getEntry functions to retrieve data from Astro content collections. | Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use getCollection and getEntry functions to retrieve data from Astro content coll... |
examples/collections-astro-collections-getcollection-javascript.text | A code snippet demonstrating how to use the getCollection function to fetch and sort content from a collection in Astro. | Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getCollection function to fetch and sort content from a collection in Astro. |
examples/collections-astro-collections-getcollection.text | An example demonstrating how to use the getCollection function to fetch and render content collection entries in an Astro component. | Exact payloads, commands, or snippets shown in An example demonstrating how to use the getCollection function to fetch and render content collection entries in an A... |
examples/collections-astro-collections-getentry-render.text | A code example demonstrating how to use getEntry and render from astro:content to fetch and display a specific content collection entry. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use getEntry and render from astro:content to fetch and display a specific conten... |
examples/collections-astro-collections-collectionentry-props-typescript.text | A TypeScript code snippet demonstrating how to use the CollectionEntry type to define component props for a content collection entry. | Exact payloads, commands, or snippets shown in A TypeScript code snippet demonstrating how to use the CollectionEntry type to define component props for a content c... |
examples/collections-astro-collections-filter-draft-entries.text | A code example demonstrating how to use getCollection to filter out content entries where the draft property is set to true. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use getCollection to filter out content entries where the draft property is set t... |
examples/collections-astro-collections-filter-draft-entries-2.text | An example demonstrating how to filter out content entries marked as drafts during a production build using getCollection. | Exact payloads, commands, or snippets shown in An example demonstrating how to filter out content entries marked as drafts during a production build using getCollec... |
examples/collections-astro-collections-filter-entries-by-subdirectory.text | An example demonstrating how to use the getCollection function to filter content collection entries by a specific subdirectory prefix. | Exact payloads, commands, or snippets shown in An example demonstrating how to use the getCollection function to filter content collection entries by a specific sub... |
examples/collections-astro-collections-getentry-getentries.text | A code example demonstrating how to use getEntry and getEntries to query content collections and retrieve referenced items in Astro. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use getEntry and getEntries to query content collections and retrieve referenced... |
examples/collections-astro-collections-getcollection-getstaticpaths.text | An example demonstrating how to use getCollection and getStaticPaths to generate dynamic routes for content collection entries in Astro. | Exact payloads, commands, or snippets shown in An example demonstrating how to use getCollection and getStaticPaths to generate dynamic routes for content collectio... |
examples/collections-astro-collections-getentry-server-request.text | An example demonstrating how to use getEntry to retrieve a content collection entry using a slug from a server-side request in Astro. | Exact payloads, commands, or snippets shown in An example demonstrating how to use getEntry to retrieve a content collection entry using a slug from a server-side r... |
examples/collections-astro-collections-define-live-collection.text | A code example demonstrating how to use defineLiveCollection with a custom loader to access real-time data in Astro content collections. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use defineLiveCollection with a custom loader to access real-time data in Astro c... |
examples/collections-astro-collections-define-live-collection-zod.text | An example demonstrating how to use defineLiveCollection with a custom loader and Zod schema validation in Astro. | Exact payloads, commands, or snippets shown in An example demonstrating how to use defineLiveCollection with a custom loader and Zod schema validation in Astro. |
examples/collections-astro-collections-getliveentry-typescript.text | A TypeScript code example demonstrating how to use the getLiveEntry function to fetch and validate content collection entries in Astro. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to use the getLiveEntry function to fetch and validate content collection... |
examples/collections-astro-collections-getlivecollection-getliveentry.text | An example demonstrating the use of getLiveCollection and getLiveEntry functions within Astro content collections. | Exact payloads, commands, or snippets shown in An example demonstrating the use of getLiveCollection and getLiveEntry functions within Astro content collections. |
examples/collections-astro-collections-config-4.text | A text example demonstrating the configuration and usage of content collections within an Astro project. | Exact payloads, commands, or snippets shown in A text example demonstrating the configuration and usage of content collections within an Astro project. |
examples/collections-astro-collections-getliveentry.text | An example demonstrating how to use the getLiveEntry function within Astro content collections to fetch dynamic entries. | Exact payloads, commands, or snippets shown in An example demonstrating how to use the getLiveEntry function within Astro content collections to fetch dynamic entries. |
examples/collections-astro-collections.text | A markdown frontmatter example demonstrating the use of a JSON schema for validating content collection entries in Astro. | Exact payloads, commands, or snippets shown in A markdown frontmatter example demonstrating the use of a JSON schema for validating content collection entries in As... |
examples/collections-astro-collections-config-json-schemas.text | A configuration snippet demonstrating how to define fileMatch patterns and schema URLs within the Astro content collections configuration. | Exact payloads, commands, or snippets shown in A configuration snippet demonstrating how to define fileMatch patterns and schema URLs within the Astro content colle... |
examples/collections-astro-collections-authors-yaml.text | A YAML file demonstrating a content collection entry for authors including a schema reference and metadata. | Exact payloads, commands, or snippets shown in A YAML file demonstrating a content collection entry for authors including a schema reference and metadata. |
examples/collections-astro-collections-yaml-configuration.text | A configuration snippet defining YAML schemas for content collections within an Astro project. | Exact payloads, commands, or snippets shown in A configuration snippet defining YAML schemas for content collections within an Astro project. |
What This Skill Covers
- Added in: [email protected]
- Main sections:
What are Content Collections?,Types of collections,When to create a collection,When not to create a collection,TypeScript configuration for collections.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://docs.astro.build/en/guides/content-collections