Docs Module

The docs module publishes documentation pages with left-sidebar navigation. Each docs section gets its own mount path, collection, and sidebar.

Adding the docs module

In karaoke.config.ts:

import { defineConfig } from '@karaoke-cms/astro';
import { docs } from '@karaoke-cms/module-docs';
import { themeDefault } from '@karaoke-cms/theme-default';

export default defineConfig({
  vault: env.KARAOKE_VAULT,
  title: 'My Site',
  theme: themeDefault(),
  modules: [
    docs(),
  ],
});

This creates a docs section at /docs, reading files from the docs/ folder in your vault.

Options

OptionDefaultDescription
mount/docsURL prefix for all routes in this section
foldermount without /Vault subfolder containing the markdown files
idfolder with slashes replaced by hyphensAstro collection name — must be unique across all docs instances
labelid in Title CaseNavigation label and page heading
enabledtrueSet false to exclude from the build
commentsfalseDefault comments visibility for all pages in this section
sidebarStyle'tree'Sidebar rendering style
layout'default'Page layout override
docs({
  mount: '/docs',
  folder: 'docs',
  label: 'Documentation',
  comments: false,
  enabled: true,
})

Routes injected

RouteDescription
/docsSection home — lists all doc titles
/docs/listFull standalone docs list
/docs/[slug]Individual doc page with sidebar

Writing docs pages

Create .md files in your vault’s docs/ folder (or whichever folder the section is configured to read from).

---
title: "Getting Started"
publish: true
description: "How to install and configure the project."
weight: 1
---

Page content here.

publish: true is required. Pages without it are excluded from the build.

Frontmatter fields

FieldDescription
titleRequired. Displayed in the sidebar and as the page heading
publishRequired. Must be true for the page to appear on the site
descriptionSummary for SEO meta tags
weightControls sidebar order — lower weight appears higher

The sidebar lists all pages in the section ordered by weight. Pages with no weight set are sorted after weighted pages, alphabetically.

# This page appears first in the sidebar
weight: 1
# This page appears second
weight: 2

Pages without a weight field are sorted alphabetically after all weighted pages.

Comments

Comments are off by default for docs sections. To enable comments on a specific page, add comments: true to its frontmatter:

---
title: "Feedback Welcome"
publish: true
comments: true
---

To enable comments on all pages in a section by default:

docs({ comments: true })

Multiple docs sections

You can add more than one docs section — for example, a main docs area and a separate API reference. See multiple-docs-sections for the full guide.