1. Home
  2. ChevronRightGetting-started
  3. ChevronRightConfiguration

Configuration

A guided walkthrough of every top-level key in boltdocs.config.ts and the real-world problems each one solves.

boltdocs.config.ts is the single configuration file for your entire documentation site. It lives at the root of your project alongside package.json and controls everything from the site title to the plugin stack and SEO behavior.

boltdocs.config.ts
import { defineConfig } from 'boltdocs'

export default defineConfig({
  siteUrl: 'https://my-project.com',
  base: '/docs',
  theme: {
    title: 'My Project',
    githubRepo: 'my-org/my-project',
  },
})

Boltdocs reads this file at startup and generates a complete Vite configuration internally. You never need to touch a vite.config.ts.


Top-Level KeysLink

PropertyTypeDefaultDescription
siteUrlstringundefinedThe production URL of your site. Critical for generating sitemap.xml and canonical SEO tags.
basestring'/'The sub-path where the docs site is deployed (e.g., /docs). All static assets and internal links will be relative to this.
docsDirstring'./docs'Path to the directory containing your Markdown content. Relative to the project root.
pluginsBoltdocsPlugin[][]An array of Boltdocs plugins. See the Plugins tab for the full plugin system reference.
themeThemeConfigControls the visual appearance, navigation, sidebar, and display options.
seoSeoConfigControls indexing behavior and Open Graph thumbnail generation.
robotsRobotsConfigGenerates robots.txt and links your sitemap.
integrationsIntegrationsConfigEnables third-party integrations such as Google Analytics 4 and Google Tag Manager.
i18nI18nConfigEnables multi-language documentation with locale-based folder routing.
versionsVersionsConfigEnables side-by-side versioned documentation.
collectionsCollectionsConfigConfigures the dynamic collections (blog) system for grouping related posts.
directoryMetaRecord<string, DirectoryMeta>Override sidebar titles, icons, and ordering for directories using meta.json files.
securitySecurityConfigConfigures HTTP security headers and CSP rules.
viteViteUserConfigExtends the internally generated Vite config with custom options.

ThemeConfigLink

Controls the entire visual shell of your documentation site.

PropertyTypeDefaultDescription
titlestring | Record<string, string>'Boltdocs'The main title shown in the navbar and browser tabs. Supports i18n locale key maps.
descriptionstringA short description used in default SEO meta tags.
logoLogoConfigundefinedCustom logo images for light and dark modes.
faviconstringPath to the favicon (relative to public/).
githubRepostringRepository in owner/repo format. Enables the GitHub link in the navbar automatically.
navbarNavbarItem[]Top-level navigation links. Supports nested dropdown items.
tabsTabConfig[]Horizontal tab strip above the sidebar. See File-System Routing.
sidebarSidebarConfigManually defined sidebar structure (disables auto-discovery for those prefixes).
sidebarGroupsRecord<string, SidebarGroupConfig>Override group titles and icons without defining a full manual sidebar.
codeThemeCodeThemeConfigShiki theme used for code block highlighting.
editLinkstringURL template for the "Edit this page" link. Use :path as a placeholder for the current file's relative path.
socialLinksSocialLink[]Extra icon links (Twitter/X, Discord, etc.) displayed in the navbar.
communityHelpstringSupport link (e.g. Discord, slack or forum URL) shown in the page footer.
versionstringRelease version string displayed in the navbar.

LogoConfigLink

PropertyTypeDefaultDescription
darkstringPath to the logo image shown in dark mode (relative to public/).
lightstringPath to the logo image shown in light mode.
altstringTitleAlt text for the logo <img>.
widthnumberExplicit pixel width for the logo image.
heightnumberExplicit pixel height for the logo image.

CodeThemeConfigLink

PropertyTypeDefaultDescription
lightstring'github-light'Shiki theme name for light mode.
darkstring'github-dark'Shiki theme name for dark mode.

Available themes: github-light, github-dark, tokyo-night, dracula, nord, one-dark-pro, one-light.


SeoConfigLink

Controls how search engines index your site and how social shares look.

PropertyTypeDefaultDescription
indexing'all' | 'none' | 'noindex' | 'nofollow''all'Controls the <meta name="robots"> directive applied to every page.
thumbnailsThumbnailConfigGenerates Open Graph images for each page using a background template.

ThumbnailConfigLink

PropertyTypeDescription
backgroundstringPath (relative to public/) to the background image used for OG thumbnails.

RobotsConfigLink

Generates a robots.txt file at build time.

PropertyTypeDescription
rulesRobotsRule[]Array of crawl rules. Each rule accepts userAgent, allow, and disallow.
sitemapsstring[]Full URLs to your sitemap(s) to include in robots.txt.
boltdocs.config.ts
export default defineConfig({
  robots: {
    rules: [
      { userAgent: '*', allow: '/' },
    ],
    sitemaps: ['https://my-project.com/sitemap.xml'],
  },
})

IntegrationsConfigLink

PropertyTypeDescription
ga4GA4ConfigGoogle Analytics 4 configuration.
gtmGTMConfigGoogle Tag Manager configuration.

GA4ConfigLink

PropertyTypeDescription
measurementIdstringYour GA4 Measurement ID (e.g., 'G-XXXXXXXXXX'). Boltdocs injects the tracking script automatically.

GTMConfigLink

PropertyTypeDescription
tagIdstringYour Google Tag Manager Container ID (e.g., 'GTM-XXXXXX').
dataLayerNamestringCustom name for GTM dataLayer (defaults to 'dataLayer').
previewstringGTM preview/environment identifier query string.

I18nConfigLink

PropertyTypeRequiredDescription
defaultLocalestringThe primary language code (e.g., 'en').
localesstring[] | Record<string, string>All supported locale codes.
localeConfigsRecord<string, LocaleConfig>Per-locale display settings (label, direction, htmlLang).

See the Internationalization guide for full details.


VersionsConfigLink

PropertyTypeRequiredDescription
defaultVersionstringThe version path considered the current default.
versionsVersionConfig[]Ordered list of available versions.
prefixstringString prepended to every version's folder path.

See the Versioning guide for full details.


CollectionsConfigLink

Configures the dynamic collections system — perfect for blogs, release notes, changelogs, or any content that follows a repeating structure. Collections are defined by bracketed folder names (e.g., [blog]) inside your docs/ directory.

PropertyTypeDefaultDescription
postsPerPagenumber10Number of posts displayed per page in collection listing indexes.
defaultCollectionstring'blog'The collection ID used by BlogList when no collection is explicitly specified.
dateFormatstring'MMMM dd, yyyy'Date format string for rendering post dates in listing pages.
sortBy'date' | 'title' | 'sidebarPosition''date'Field used to sort posts within a collection.
labelsRecord<string, string | Record<string, string>>Per-collection human-readable label. Falls back to the collection id.
positionsRecord<string, number>Manual numeric ordering for collection indexes in the sidebar.
boltdocs.config.ts
export default defineConfig({
  collections: {
    postsPerPage: 12,
    defaultCollection: 'blog',
    dateFormat: 'MMM dd, yyyy',
    sortBy: 'date',
    labels: {
      blog: 'Engineering Blog',
      changelog: 'Release Notes',
    },
    positions: {
      blog: 1,
      changelog: 2,
    },
  },
})
Lightbulb
Quick Setup

Collections work out of the box with zero configuration. Simply create a bracketed folder like [blog] inside docs/ and add your MDX files. Use collections only when you need to override the defaults.

See the Collections guide for full details on folder conventions, custom views, and loader data.


DraftsConfigLink

Control the visibility of draft pages across different environments.

PropertyTypeDefaultDescription
visiblebooleanfalseIf true, drafts are visible in all environments.
environmentsstring[][]Environments where drafts are visible (e.g., ['development', 'staging']).

BehaviorLink

  • Production (default): Drafts are excluded from builds. Pages with draft: true in frontmatter are filtered out.
  • Development: Drafts are hidden by default unless drafts.visible: true or BOLTDOCS_DRAFTS=true is set.
  • Environment override: Set BOLTDOCS_DRAFTS=true to force drafts visible in any environment.
  • Config override: Set drafts.visible: true or drafts.environments: ['development', 'staging'] to control per-environment visibility.

Environment VariablesLink

VariableEffect
BOLTDOCS_DRAFTS=trueForces draft pages to be visible, overriding all config settings
NODE_ENV=productionDefault production mode — drafts are excluded unless drafts.visible: true
NODE_ENV=developmentDefault development mode — drafts are hidden unless enabled via config or env
---
title: My Draft Page
draft: true
---
AlertTriangle
Drafts in Production

When drafts.visible: true is set, draft pages will appear in production builds. Use this only for preview deployments or staging environments.


FeatureFlagsLink

Control page visibility based on feature flags. Pages can declare required flags in their frontmatter, and only render when all flags are active in the config.

PropertyTypeDescription
featureFlagsRecord<string, boolean | string>Feature flag definitions. boolean = always on/off. string = only active when matches NODE_ENV.

How It WorksLink

  1. Add featureFlags to your config:
boltdocs.config.ts
export default defineConfig({
  featureFlags: {
    'new-dashboard': true,           // Always visible
    'beta-api': 'development',       // Only in development
    'experimental-search': false,    // Always hidden
  },
})
  1. Mark pages with required flags:
---
title: New Dashboard
featureFlags:
  - new-dashboard
  - beta-api
---
  1. The page only renders when all declared flags are active in the config.
Lightbulb
Use Cases
  • Progressive rollout: Enable features per environment
  • A/B testing: Toggle pages based on config
  • Internal tools: Hide pages from public builds

directoryMetaLink

A powerful mechanism to customize how directories appear in the sidebar without writing any code. Boltdocs automatically scans for meta.json files inside your docs/ directory and merges them into the sidebar configuration at build time.

PropertyTypeDescription
titlestringCustom display title for the directory in the sidebar.
ordernumber | string[]Numeric position or explicit ordering of child items within the directory.
iconstringIcon name displayed next to the directory label (supports Lucide icons).
collapsiblebooleanWhether the sidebar group is collapsible.
collapsedbooleanWhether the group starts in a collapsed state.

Drop a meta.json (or _meta.json) into any directory to configure it automatically:

(guides)/getting-started/meta.json
{
  "title": "Getting Started",
  "order": 1,
  "icon": "Rocket",
  "collapsed": false
}

Using directoryMeta in ConfigLink

You can also define metadata directly in boltdocs.config.ts for directories you don't own or when you prefer centralized configuration:

boltdocs.config.ts
export default defineConfig({
  directoryMeta: {
    'guides/getting-started': {
      title: 'Quick Start',
      icon: 'Zap',
      order: 0,
    },
    'api': {
      title: 'API Reference',
      icon: 'Code2',
      collapsed: false,
    },
  },
})
Info
Path Format

Directory keys use the relative path from your docs/ directory (e.g., 'guides/getting-started'). The root directory is represented as '.'.


SecurityConfigLink

Configure response headers, security settings, and Content Security Policy (CSP).

PropertyTypeDescription
enableCSPbooleanSet to true to inject a default secure Content Security Policy header.
headersRecord<string, string>Custom HTTP headers sent on all requests.
customHeadersRecord<string, string>Additional override headers for the web server.

Full ExampleLink

boltdocs.config.ts
import { defineConfig } from 'boltdocs'
import mermaidPlugin from '@bdocs/plugin-mermaid'

export default defineConfig({
  siteUrl: 'https://my-project.com',
  base: '/docs',
  plugins: [mermaidPlugin()],
  seo: {
    indexing: 'all',
    thumbnails: {
      background: '/og-image.webp',
    },
  },
  theme: {
    title: 'My Project',
    description: 'My project documentation.',
    logo: {
      dark: '/logo-light.svg',
      light: '/logo-dark.svg',
      alt: 'My Project Logo',
    },
    githubRepo: 'my-org/my-project',
    codeTheme: {
      light: 'github-light',
      dark: 'github-dark',
    },
    editLink: 'https://github.com/my-org/my-project/edit/main/docs/:path',
    tabs: [
      { id: 'guides', text: 'Guides', icon: 'BookOpen' },
      { id: 'api', text: 'API', icon: 'Code2' },
    ],
    navbar: [
      { label: 'Docs', href: '/docs' },
    ],
  },
  robots: {
    rules: [{ userAgent: '*', allow: '/' }],
    sitemaps: ['https://my-project.com/sitemap.xml'],
  },
  collections: {
    postsPerPage: 12,
    defaultCollection: 'blog',
    sortBy: 'date',
  },
  drafts: {
    visible: false,
    environments: ['development'],
  },
  featureFlags: {
    'new-dashboard': true,
    'beta-api': 'development',
  },
  directoryMeta: {
    'guides/getting-started': {
      title: 'Quick Start',
      icon: 'Zap',
      order: 0,
    },
  },
  integrations: {
    ga4: {
      measurementId: 'G-XXXXXXXXXX',
    },
  },
})
Last updated on July 27, 2026

Was this page helpful?