Modules Reference

All modules are passed to defineConfig({ modules: [...] }) in karaoke.config.ts. The karaoke() integration flattens nested arrays, so docs([...]) (which returns ModuleInstance[]) can be passed directly.


blog

Package: @karaoke-cms/module-blog

import { blog } from '@karaoke-cms/module-blog';

Signature

function blog(config?: {
  mount?:    string;
  id?:       string;
  enabled?:  boolean;
  comments?: boolean;
}): ModuleInstance

Options

NameTypeDefaultDescription
mountstring'' (root)URL prefix for all blog routes.
idstring'blog'Module identifier.
enabledbooleantrueWhen false, routes and menu entries are skipped.
commentsbooleantrueDefault comments state for all posts. Per-post frontmatter overrides this.

Routes injected

PatternEntrypoint
{mount}@karaoke-cms/module-blog/pages/list
{mount}/[slug]@karaoke-cms/module-blog/pages/post
{mount}/page/[page]@karaoke-cms/module-blog/pages/page
Menu sectionTextPathWeight
mainBlog{mount} or /10
footerRSS/rss.xml10

docs

Package: @karaoke-cms/module-docs

import { docs } from '@karaoke-cms/module-docs';

Signature (overloaded)

// Single section — returns one ModuleInstance
function docs(config?: DocsConfig): ModuleInstance

// Multiple sections — returns one ModuleInstance per active section
function docs(sections: DocsSection[]): ModuleInstance[]

DocsConfig options (single form)

NameTypeDefaultDescription
mountstring'/docs'URL prefix for this docs section.
folderstringmount without /Vault subfolder containing markdown files.
idstringfolder with /-Astro collection name. Must be unique.
labelstringid in Title CaseNav label and page heading.
enabledbooleantrueWhen false, excluded from build.
commentsbooleanfalseDefault comments state for pages in this section.
layoutstring'default'Layout component override.
sidebarStylestring'tree'Sidebar style. Values: 'flat', 'grouped'.

DocsSection fields (array form)

Extends DocsConfig with:

NameTypeDefaultDescription
weightnumber20Menu weight. Blog = 10, Tags = 30. Use 11–29 to appear between them.
parentstringId of a root-level nav entry to nest under. Single-level only. Falls back to root with a warning if not found.

Sections with enabled: false are excluded from the returned array.

Routes injected (per instance, via codegen)

Routes are code-generated into .astro/generated/karaoke-cms/{id}/ at build time. Each instance gets:

PatternDescription
{mount}Docs home — list of all doc titles
{mount}/listFull docs list
{mount}/[slug]Individual doc with sidebar
Menu sectionTextPathWeight
main{label}{mount}weight (default 20)

Multiple sections example

modules: [
  docs([
    { id: 'docs',    mount: '/docs',     label: 'Docs',          weight: 20 },
    { id: 'api',     mount: '/api-docs', folder: 'api-reference', label: 'API Reference', weight: 25, parent: 'docs' },
  ]),
]

tags

Package: @karaoke-cms/module-tags

import { tags } from '@karaoke-cms/module-tags';

Signature

function tags(config?: {
  mount?:   string;
  enabled?: boolean;
}): ModuleInstance

Options

NameTypeDefaultDescription
mountstring'/tags'URL prefix for tags routes. Cannot be '/' or empty.
enabledbooleantrueWhen false, routes are not injected.

Routes injected

PatternEntrypoint
{mount}@karaoke-cms/module-tags/pages/index
{mount}/[tag]@karaoke-cms/module-tags/pages/tag
{mount}/[tag]/rss.xml@karaoke-cms/module-tags/pages/tag-rss
Menu sectionTextPathWeight
mainTags{mount}30

Notes

Aggregates tags from the blog collection and all active docs sections automatically. No explicit sources config needed.


Package: @karaoke-cms/module-search

import { search } from '@karaoke-cms/module-search';

Signature

const search: (config?: {
  mount?:   string;
  enabled?: boolean;
}) => ModuleInstance

search is a module instance factory produced by defineModule(). Call it like a function.

Options

NameTypeDefaultDescription
mountstring'/search'URL for the search page.
enabledbooleantrueWhen false, routes are not injected.

Routes injected

PatternEntrypoint
{mount}@karaoke-cms/module-search/pages/search
Menu sectionTextPathWeight
mainSearch{mount}90

Build behavior

  • Production: Runs npx pagefind --site dist/ after astro:build:done to generate the full-text search index.
  • Dev mode: Serves the pre-built index from dist/pagefind/ at /pagefind/. Run pnpm build once first to generate the index; after that, search works in dev without a rebuild.

comments

Package: @karaoke-cms/module-comments

import { comments } from '@karaoke-cms/module-comments';

Signature

function comments(config: {
  repo:        string;
  repoId:      string;
  category?:   string;
  categoryId?: string;
  enabled?:    boolean;
}): ModuleInstance

Options

NameTypeRequiredDefaultDescription
repostringYesGitHub repo in "owner/repo" format. Must have Discussions enabled.
repoIdstringYesGitHub repo node ID. Get from giscus.app.
categorystringNo'General'GitHub Discussions category name.
categoryIdstringNo''GitHub Discussions category node ID. Get from giscus.app.
enabledbooleanNotrueWhen false, module is excluded from the build.

Routes injected

None. The Giscus widget is embedded by the theme on post and doc pages.

None.

Notes

Whether comments appear on a specific page is controlled by:

  1. blog({ comments: true/false }) or docs({ comments: true/false }) — module-level default
  2. comments: true/false in page frontmatter — per-page override

seo

Package: @karaoke-cms/module-seo

import { seo } from '@karaoke-cms/module-seo';

Signature

function seo(config?: {
  disallow?: string[];
  llmsTxt?: boolean;
  llmsSiteTitle?: string;
  llmsTxtExtra?: string;
  contentManifest?: boolean;
}): ModuleInstance

Options

NameTypeDefaultDescription
disallowstring[]['/karaoke-cms/']URL path prefixes to block in robots.txt.
llmsTxtbooleantrue (when site is set)When false, skip /llms.txt.
llmsSiteTitlestringhostname# title in llms.txt.
llmsTxtExtrastringExtra Markdown appended to llms.txt.
contentManifestbooleantrue (when site is set)When false, skip karaoke-public-content.json.

Routes injected

None.

None.

Build behavior

Runs after astro:build:done:

  1. Generates OG social card images for all published blog posts and docs pages.
  2. Ensures <link rel="canonical" href="{og:url}"> on every built HTML page that has og:url and no existing canonical link.
  3. Writes robots.txt with the configured disallow paths and a Sitemap: line when site is set and a sitemap XML exists in dist/.
  4. Writes llms.txt when site is set and llmsTxt is not false.
  5. Writes karaoke-public-content.json when site is set and contentManifest is not false.
  6. Injects JSON-LD structured data into pages.