Setting Up Multiple Collections
Multiple collections allow you to run different documentation systems from one codebase. Each collection is completely independent with its own folder, routes, and navigation.
Why Multiple Collections?
You might need multiple collections for:
- User documentation + API reference
- Documentation for different products
- Different versions of documentation
- Multiple audience types (beginners vs. advanced)
- Separate internal and public docs
Basic Setup
Step 1: Register Collections
In data/config.ts, add to CONTENT.systems:
export const CONTENT: ContentConfig = {
systems: [
{
id: "docs",
dir: "content/docs",
defaultDocRedirect: "/docs/introduction",
route: "/docs",
},
{
id: "api",
dir: "content/api",
defaultDocRedirect: "/api/overview",
route: "/api",
},
{
id: "guides",
dir: "content/guides",
defaultDocRedirect: "/guides/getting-started",
route: "/guides",
},
],
};
Step 2: Create Content Folders
mkdir -p content/docs
mkdir -p content/api
mkdir -p content/guides
Step 3: Configure Navigation
Each collection needs its own navigation in SIDEBAR_NAVIGATION:
export const SIDEBAR_NAVIGATION = {
docs: {
defaultTab: { label: "Docs", icon: "π" },
groups: [
/* docs navigation */
],
},
api: {
defaultTab: { label: "API", icon: "π‘" },
groups: [
/* api navigation */
],
},
guides: {
defaultTab: { label: "Guides", icon: "π" },
groups: [
/* guides navigation */
],
},
};
Step 4: Add Content
Create markdown files in each collection folder. Theyβll automatically be discoverable and routed correctly.
Three-Collection Example
A typical multi-collection setup:
docs/ -> /docs/*
βββ getting-started/
βββ features/
βββ help/
api/ -> /api/*
βββ v1/
βββ v2/
βββ authentication/
guides/ -> /guides/*
βββ tutorials/
βββ patterns/
βββ examples/
Each collection appears at its own route and has independent navigation.
Collections with Different Configurations
Each collection can have completely different structures:
Collection 1 (docs): Simple auto-generated structure
docs: {
defaultTab: { label: "Learn" },
groups: [
{ id: "guides", label: "Guides", autoGenerated: true }
],
}
Collection 2 (api): Complex with tabs and nesting
api: {
defaultTab: { label: "v2" },
groups: [
{
id: "v2",
label: "v2 Current",
tab: true,
groups: [
{ id: "endpoints", label: "Endpoints", autoGenerated: true },
{ id: "auth", label: "Auth", autoGenerated: true },
],
},
],
}
URL Structure
With this setup, URLs map automatically:
File: content/docs/getting-started/intro.md
URL: /docs/getting-started/intro
File: content/api/v2/endpoints/users.md
URL: /api/v2/endpoints/users
File: content/guides/tutorials/first-app.md
URL: /guides/tutorials/first-app
Next Steps
Learn about: