The docmd.config.js file serves as the definitive configuration for your documentation project. It controls site structure, branding, UI behavior, and engine-level processing rules.
The Configuration File
We recommend using the defineConfig helper provided by @docmd/core. This provides full IDE autocomplete and type-checking, enabling effortless discovery of available settings.
import { defineConfig } from '@docmd/core';
export default defineConfig({
title: 'My Project',
url: 'https://docs.myproject.com',
// ... configuration settings
});
Core Settings
docmd utilizes a streamlined configuration schema. Below are the primary top-level settings:
| Key | Description | Default |
|---|---|---|
title |
The name of your documentation site. Used in the header and browser titles. | Documentation |
url |
Your production base URL. Critical for SEO, Sitemaps, and OpenGraph. | null |
src |
The relative path to the directory containing your Markdown files. | docs |
out |
The relative path for the generated static site output. | site |
base |
The base path if hosting in a subfolder (e.g., /docs/). |
/ |
Branding & Identity
Configure how your brand is represented in the navigation header and browser tabs.
logo: {
light: 'assets/images/logo-dark.png', // Logo shown in Light Mode
dark: 'assets/images/logo-light.png', // Logo shown in Dark Mode
href: '/', // Link destination when clicking the logo
alt: 'Company Logo', // Alternative text for accessibility
height: '32px' // Optional: Explicit height for the logo
},
favicon: 'assets/favicon.ico', // Path to your site's favicon
Layout Architecture
docmd features a modular layout system. You can toggle UI components and configure navigation behavior via the layout object.
| Section | Key | Default | Description |
|---|---|---|---|
| Global | spa |
true |
Enables seamless Single Page Application navigation without browser reloads. |
| Header | header |
{ enabled: true } |
Toggles the top navigation bar. |
| Sidebar | sidebar |
{ enabled: true, collapsible: true } |
Controls the sidebar navigation tree and its behavior. |
| Footer | footer |
{ style: 'minimal' } |
Supports 'minimal' or 'complete' footer styles. |
Utility Menu (Options Menu)
The Options Menu consolidates utility components suchs as Global Search, Theme Switching, and Sponsorship links.
layout: {
optionsMenu: {
position: 'header', // Options: 'header', 'sidebar-top', 'sidebar-bottom', 'menubar'
components: {
search: true, // Enable built-in full-text search
themeSwitch: true, // Enable Light/Dark mode toggle
sponsor: 'https://github.com/sponsors/your-profile' // Optional URL for a heart icon/link
}
}
}
If optionsMenu.position is set to header or menubar but those containers are disabled, the menu will automatically fall back to sidebar-top.
Core Engine Features
Fine-tune how docmd processes and renders your documentation content.
minify: true, // Minifies production assets (CSS/JS) for better performance
autoTitleFromH1: true, // Uses the first H1 heading as the page title if frontmatter 'title' is missing
copyCode: true, // Adds a 'Copy' button to all code blocks automatically
pageNavigation: true, // Adds 'Previous' and 'Next' navigation links at the bottom of pages
Legacy Support
If you are upgrading from an older version of docmd, the following keys are automatically mapped to the modern schema for backward compatibility:
siteTitle→titlesiteUrl/baseUrl→urlsrcDir/source→srcoutDir/outputDir→out
Execute docmd migrate to automatically upgrade your configuration file to the latest schema while preserving a backup of your original settings.