How Auto-Generation Works
Auto-generation is one of CelestialDocsβ most powerful features. Enable it on a group, and files automatically appear in the sidebar without additional configuration.
What is Auto-Generation?
When autoGenerated: true, the system:
- Scans the folder matching your group ID (or configured path)
- Finds all
.mdand.mdxfiles - Creates entries sorted alphabetically
- Updates automatically when you add new files
Basic Example
Configuration
{
id: "features",
label: "Features",
autoGenerated: true, // <- Enable auto-discovery
}
File Structure
content/my-docs/features/
βββ auto-generation.md <- Automatically discovered
βββ breadcrumbs.md <- Automatically discovered
βββ icons.md <- Automatically discovered
βββ table-of-contents.md <- Automatically discovered
Result
Sidebar automatically shows:
Features
βββ Auto Generation (sorted alphabetically)
βββ Breadcrumbs
βββ Icons
βββ Table Of Contents
No configuration needed for each file!
How Labels Are Generated
Filenames are converted to readable labels:
File: auto-generation.md
-> Slug: auto-generation
-> Label: "Auto Generation" (title-cased, dashes to spaces)
File: rest-api-integration.md
-> Slug: rest-api-integration
-> Label: "Rest Api Integration" (each word title-cased)
File: FAQ.md
-> Slug: faq
-> Label: "Faq"
Override with frontmatter if needed:
---
title: "Frequently Asked Questions" <- Used in browser tab
navLabel: "FAQ" <- Used in sidebar
---
Folder Path Matching
By default, group ID matches the folder:
// Group ID: "features"
{ id: "features", label: "Features", autoGenerated: true }
// Looks in: content/[collection]/features/
Customize with path:
// Group ID: "help"
// But scan folder: "common-questions"
{
id: "help",
label: "Help",
autoGenerated: true,
path: "common-questions",
}
// Looks in: content/[collection]/common-questions/
Filtering Files
Auto-generation respects frontmatter flags:
Hide Specific Pages
---
title: "Internal Notes"
navHidden: true <- Won't appear in sidebar
---
Page is still accessible via direct URL but doesnβt appear in navigation.
Draft Pages
---
title: "Work in Progress"
draft: true <- Excluded from production build
---
Result
Features
βββ Auto Generation
βββ Breadcrumbs
βββ Icons
βββ Table Of Contents
(Internal Notes doesn't appear)
Ordering
Auto-discovered files are sorted alphabetically by filename (case-insensitive):
Files:
βββ 01-introduction.md <- Appears first
βββ 02-installation.md <- Appears second
βββ advanced.md <- Auto-alphabetically ordered
βββ breadcrumbs.md
βββ configuration.md
βββ deployment.md
βββ zz-advanced.md <- Appears last
To control order:
- Use numeric prefixes:
01-intro.md,02-install.md - Or use manual configuration (see next section)
Auto-Generation with Nested Groups
Auto-discovery works at every level:
{
id: "documentation",
label: "Documentation",
groups: [
{
id: "guides",
label: "Guides",
autoGenerated: true, // Scans content/my-docs/documentation/guides/
},
{
id: "api",
label: "API",
groups: [
{
id: "endpoints",
label: "Endpoints",
autoGenerated: true, // Scans content/my-docs/documentation/api/endpoints/
},
],
},
],
}
Real-World Examples
Documentation Site
{
id: "docs",
label: "Documentation",
autoGenerated: true,
}
Create files, they appear automatically:
content/my-docs/
βββ getting-started.md
βββ installation.md
βββ configuration.md
βββ advanced-setup.md
Sidebar shows alphabetically.
Feature List
{
id: "features",
label: "Features",
autoGenerated: true,
}
Add feature docs:
content/my-docs/features/
βββ authentication.md
βββ caching.md
βββ webhooks.md
Updates automatically.
When to Use Auto-Generation
β Good for:
- Growing documentation
- Large numbers of pages
- Frequently changing content
- Alphabetical ordering acceptable
- Multiple people contributing
β Not ideal for:
- Specific ordering required
- Carefully curated selection
- Hide many files from navigation
- Need custom labels throughout
Combining with Manual Entries
Use entries + autoGenerated: true for hybrid approach:
{
id: "guides",
label: "Guides",
entries: [
{ slug: "guides/overview" }, // Always first
{ slug: "guides/quick-start" }, // Always second
],
autoGenerated: true, // Rest auto-discovered
}
See Hybrid Approach for details.
Performance
Auto-generation happens at build time, not runtime. Performance impact is negligible even with 1000+ files.
Troubleshooting
Files not appearing?
- Check file is in correct folder
- Verify
autoGenerated: trueis set - Look for
navHidden: truein frontmatter - Check
draft: truein frontmatter
Order is wrong?
- Use numeric prefixes:
01-,02-, etc. - Or use manual entries for precise control
Label looks wrong?
- Add
navLabel:to frontmatter - Or override in manual entries
Next Steps
Learn about: