Create Your First Collection
A collection is an independent documentation system with its own content folder, routes, and navigation structure. Letβs create your first one.
Step 1: Create the Content Directory
Create a new folder in content/ for your collection:
mkdir -p content/my-docs/guides
Step 2: Add a First Page
Create your first markdown file:
# content/my-docs/guides/hello.md
Add this content:
---
title: "Hello World"
description: "Your first page in CelestialDocs"
---
# Hello World
This is your first page! Edit `content/my-docs/guides/hello.md` to change this content.
Step 3: Register the Collection
Open data/config.ts and add your collection to CONTENT.systems:
export const CONTENT: ContentConfig = {
systems: [
{
id: "docs",
dir: "content/docs",
defaultDocRedirect: "/docs/getting-started/introduction",
route: "/docs",
},
// Add your new collection:
{
id: "my-docs",
dir: "content/my-docs",
defaultDocRedirect: "/my-docs/guides/hello", // Where to redirect
route: "/my-docs", // Base URL route
},
],
};
What each property means:
id: Unique identifier for your collectiondir: Folder path containing the markdown filesdefaultDocRedirect: Where to send users when they visit/my-docs/route: URL base for all pages in this collection
Step 4: Add Navigation Configuration
Still in data/config.ts, add navigation configuration to SIDEBAR_NAVIGATION:
export const SIDEBAR_NAVIGATION: SidebarNavigation = {
// ... existing configurations ...
"my-docs": {
defaultTab: {
label: "Guides",
icon: "π",
},
groups: [
{
id: "guides",
label: "Getting Started",
icon: "π",
autoGenerated: true, // Auto-discover files in content/my-docs/
},
],
},
};
Step 5: Visit Your Collection
Navigate to http://localhost:4321/my-docs/guides/hello
You should see your first page with:
- β Sidebar navigation
- β Breadcrumb trail
- β Table of contents
- β Proper styling
Understanding the Configuration
The configuration you added connects three things:
- File System (
content/my-docs/guides/hello.md) β - Navigation Config (
SIDEBAR_NAVIGATION["my-docs"]) β - Route (
/my-docs/guides/hello)
When a user visits the route, the system:
- Loads your markdown file
- Renders it with the layout
- Builds sidebar navigation from your config
- Shows breadcrumbs based on folder structure
Next Steps
- Learn about Groups and Entries
- Explore Navigation Configuration
- Add more pages to grow your documentation