Search Documentation

Search for pages and headings in the documentation

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 collection
  • dir: Folder path containing the markdown files
  • defaultDocRedirect: 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:

  1. File System (content/my-docs/guides/hello.md) ↓
  2. Navigation Config (SIDEBAR_NAVIGATION["my-docs"]) ↓
  3. Route (/my-docs/guides/hello)

When a user visits the route, the system:

  1. Loads your markdown file
  2. Renders it with the layout
  3. Builds sidebar navigation from your config
  4. Shows breadcrumbs based on folder structure

Next Steps