./content/<product>/<version>/data directory. Each file configures navigation for a specific section of a product’s documentation.
For example, docs-nav-data.json controls the navigation for the product’s Documentation section on developer.hashicorp.com.
Nav-data file location
Sidebar files are in thecontent/<product>/<version>/data directory. Any file in this directory whose name ends in -nav-data controls navigation for the given section.
| File name | Controls navigation for |
|---|---|
docs-nav-data.json | The docs section |
api-docs-nav-data.json | The API docs section |
cli-nav-data.json | The CLI reference section |
web-unified-docs/content/vault/v1.20.x/data/docs-nav-data.json controls the Vault docs v1.20.x sidebar.
Nav-data file format
The nav-data file is a JSON array of node objects. Each node is either a directory node (hasroutes) or a leaf node (has path).
Node properties
| Property | Type | Description |
|---|---|---|
title | string | Human-readable label shown in the navigation sidebar. |
path | string | URL path where the .mdx document renders. Used on leaf nodes only. |
routes | array | Child nodes for this directory entry. Presence of routes makes this a directory node. |
href | string | An explicit URL (internal or external) instead of a path reference. |
Rules and conventions
- Ordering is flexible, but hierarchy is not. You can reorder sibling entries in any order, or omit entries entirely, but you cannot un-nest a directory node without also un-nesting it in the filesystem.
index.mdxfiles must be explicitly listed in the nav-data. The path resolves from the directory name: use"path": "directory"rather than"path": "directory/index".- A common convention is to set the
titleof an index node to"Overview". - An
index.mdxfile is not required for every subdirectory.
Adding a new page to the sidebar
After creating a new.mdx file, add an entry to the corresponding nav-data file in the data directory.
Identify the correct nav-data file
Navigate to
content/<product>/<version>/data/ and open the file that matches your section (for example, docs-nav-data.json for content under docs/).Nested navigation entries
To add a new subdirectory to the navigation, create a directory node with aroutes array. The node must correspond to an actual subdirectory in the filesystem.
Custom and external links
Use thehref property instead of path to include links that point outside the docs file hierarchy:
href links display a small external link icon in the sidebar. Internal href links appear the same as regular file links.
How sidebar data is served
The nav-data JSON is read by theweb-unified-docs API and served to the dev-portal front end, which renders the sidebar. Changes merged to main appear on developer.hashicorp.com typically within 30 minutes.
For versioned products, the API serves the nav-data from the version folder matching the version the user has selected in the version picker.