@@ -25,6 +25,7 @@ The `web` generator accepts the following configuration options:
2525| ` imports ` | ` object ` | See below | Object mapping ` #theme/ ` aliases to component paths for customization |
2626| ` virtualImports ` | ` object ` | ` {} ` | Additional virtual module mappings supplied to the server and client builds |
2727| ` components ` | ` object ` | ` {} ` | Maps JSX tag names to component imports, enabling JSX-in-MDX (see below) |
28+ | ` navigation ` | ` object ` | ` {} ` | Sidebar groups and navigation bar items (see below) |
2829| ` bundler ` | ` WebBundler ` | Vite adapter | Adapter that renders server entries and writes the client and HTML output (see below) |
2930
3031### ` head `
@@ -71,6 +72,56 @@ export default {
7172> via ` head ` , including ` og:title ` (which mirrors the per-page title) and
7273> ` og:type ` . The UI stylesheet bundles its fonts locally.
7374
75+ ### ` navigation `
76+
77+ The ` navigation ` object supplies the site's two navigation surfaces. Both keys
78+ are optional; omit either one to keep that component's default.
79+
80+ | Key | Type | Description |
81+ | --------- | ------- | ---------------------------------------------------------------------------------------------------------- |
82+ | ` sidebar ` | ` array ` | Sidebar groups, each ` { groupName, items } ` . Defaults to one ` API Documentation ` group holding every page. |
83+ | ` navbar ` | ` array ` | Navigation bar items, each ` { text, link, target? } ` . Defaults to none, which renders no items. |
84+
85+ Sidebar items are ` { label, link } ` and may nest through an ` items ` array of
86+ their own. A ` label ` is plain text, except that backticked spans render as
87+ ` <code> ` (`` '`fs` Generator' `` ), matching how page headings are rendered. A
88+ ` link ` is a page path without its extension (` /fs ` , ` /generators/web ` ): it is
89+ resolved against the page being rendered, so it obeys ` useAbsoluteURLs ` and
90+ highlights while it is the current page. Links starting with ` http:// ` or
91+ ` https:// ` are used as authored.
92+
93+ Navigation bar links are always used as authored, since they typically point
94+ outside the generated site. Give them a ` target ` of ` '_blank' ` to open in a new
95+ tab and mark them with an external-link icon.
96+
97+ ``` js
98+ // doc-kit.config.mjs
99+ export default {
100+ web: {
101+ navigation: {
102+ sidebar: [
103+ {
104+ groupName: ' Guides' ,
105+ items: [{ label: ' Getting started' , link: ' /getting-started' }],
106+ },
107+ {
108+ groupName: ' Reference' ,
109+ items: [{ label: ' `fs`' , link: ' /fs' }],
110+ },
111+ ],
112+ navbar: [
113+ { text: ' Learn' , link: ' https://nodejs.org/en/learn' },
114+ { text: ' Download' , link: ' https://nodejs.org/en/download' },
115+ ],
116+ },
117+ },
118+ };
119+ ```
120+
121+ The sidebar also renders a version ` <Select> ` built from ` changelog ` . A site
122+ configured without one has no versions to switch between, so the control is
123+ omitted rather than rendered empty.
124+
74125### Bundler adapters
75126
76127The ` bundler ` option accepts a small Doc Kit adapter rather than configuration
@@ -261,8 +312,6 @@ import { project, repository, editURL } from '#theme/config';
261312
262313### Available exports
263314
264- All scalar (non-object) configuration values are automatically exported. The defaults include:
265-
266315| Export | Type | Description |
267316| ------------------------ | ------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
268317| ` project ` | ` string ` | Project name (e.g. ` 'Node.js' ` ) |
@@ -271,6 +320,7 @@ All scalar (non-object) configuration values are automatically exported. The def
271320| ` versions ` | ` Array<{ url, label, major }> ` | Pre-computed version entries with labels and URL templates (only ` {path} ` remains for per-page use) |
272321| ` editURL ` | ` string ` | Partially populated "edit this page" URL template (only ` {path} ` remains) |
273322| ` pages ` | ` Array<[string, string]> ` | Sorted ` [name, path] ` tuples for sidebar navigation |
323+ | ` navigation ` | ` object ` | Mirrors the configured ` navigation ` (consumed by the built-in ` SideBar ` and ` NavBar ` ) |
274324| ` useAbsoluteURLs ` | ` boolean ` | Whether internal links use absolute URLs (mirrors config value) |
275325| ` baseURL ` | ` string ` | Base URL for the documentation site (used when ` useAbsoluteURLs ` is ` true ` ) |
276326| ` languageDisplayNameMap ` | ` Map<string, string> ` | Shiki language alias → display name map for code blocks |
0 commit comments