The nav.json Reference
Control the sidebar order, section titles, and top-level tabs of your APIMatic developer portal with nav.json.
Every folder under content/ can contain a nav.json file. It tells APIMatic how to label that folder in the sidebar and in what order to show the pages and subfolders inside it. The nav.json at the root of content/ can also define which folders appear as tabs across the top of your portal.
Here's a sample structure of your source folder:
src/
apimatic.json
content/
nav.json # root: page order + tabs
index.md
guides/
nav.json # folder: title + page order
authentication.md
pagination.md
spec/
openapi.yamlHow it works
When APIMatic builds your portal, it reads content/ folder by folder:
- Each
.mdor.mdxfile becomes a page. Its sidebar label comes from thetitlein the page's frontmatter. - Each folder becomes a sidebar section. If the folder has a
nav.json, itstitleis used as the section label and itspagesarray sets the order of items in that section. - The
"..."entry inpagesstands for every item in the folder that isn't listed by name, so new pages show up without editingnav.json. - The root
nav.jsoncan list items intabs. Each of those becomes its own tab. Everything not listed intabsis placed in the Home tab.
Sample root nav.json
{
"tabs": ["apimatic:sdks", "apimatic:plugin", "apimatic:api"],
"pages": ["index", "..."]
}This is the default root nav.json of a new portal. It shows SDKs, Context Plugins, and API Reference as tabs. In the Home tab, index is shown first, followed by every other top-level page and folder.
Properties in nav.json file
| Property | Type | Where | Description |
|---|---|---|---|
title | string | Any folder | Label shown for the folder in the sidebar (or on its tab). Defaults to the folder name. |
pages | string[] | Any folder | Order of the pages and subfolders inside this folder. "..." adds all items not listed. Default: ["index", "..."] in the root, ["..."] in a subfolder. |
tabs | string[] | Root content/nav.json | Folders to show as top-level tabs. Anything not listed goes into the Home tab. Default: ["apimatic:sdks", "apimatic:plugin", "apimatic:api"]. |
Title
The display name of the folder. Use it to give a folder a readable label without renaming the folder on disk.
{
"title": "Guides"
}Pages
An ordered list of the items in the folder. Each entry is the file name without the .md or .mdx extension, the name of a subfolder, or "...".
A subfolder starts with this default nav.json:
{
"pages": ["..."]
}The root content/nav.json also includes the default tabs (see Sample root nav.json).
"..." adds all pages and subfolders in the folder. Replace "..." with names to set an exact order, or keep it at the end to list a few items first and let the rest follow:
{
"title": "Guides",
"pages": ["authentication", "..."]
}To fully control the order, list every item:
{
"title": "Guides",
"pages": ["authentication", "pagination", "errors"]
}This renders the Guides section as:
Guides
Authentication
Pagination
ErrorsNotes:
- Entries are names relative to the folder that contains the
nav.json, not paths. Use"authentication", not"guides/authentication"or"authentication.md". - A subfolder is listed by its folder name. Its own
nav.jsoncontrols what's inside it.
Tabs
tabs is only read from the root content/nav.json. Each entry is the name of a top-level folder in content/, and each one is shown as a separate tab at the top of the portal.
- A folder listed in
tabsbecomes a tab. The tab's label is the folder'stitlefrom its ownnav.json, and the tab's sidebar shows that folder's contents. - Tabs appear in the order you list them, after the Home tab.
- Any folder not listed in
tabsis added to the Home tab by default. - New portals start with three built-in tabs: SDKs, Context Plugins, and API Reference.
- If you remove
tabsentirely, there's no tab bar, and SDKs, Context Plugins, and API Reference appear in the Home sidebar.
{
"title": "Home",
"tabs": ["guides", "apimatic:sdks", "apimatic:plugin", "apimatic:api"],
"pages": ["index", "..."]
}This produces five tabs:
| Tab | Contains |
|---|---|
| Home | index and every other page or folder not in tabs |
| Guides | Contents of the guides folder |
| SDKs | Your SDKs |
| Context Plugins | Your Context Plugins |
| API Reference | Your API reference |
The title in the root nav.json sets the label of the Home tab.
Built-in tabs
SDKs, Context Plugins, and API Reference are listed in tabs by these built-in names:
| Name | Tab |
|---|---|
apimatic:sdks | SDKs |
apimatic:plugin | Context Plugins |
apimatic:api | API Reference |
They're included in tabs by default. To show your own folders next to them, add the folder names to the same list. If you remove one of these names, that section moves into the Home sidebar.
Update your nav.json
To change how your portal is organized, edit the nav.json files in content/:
- Reorder a section: open that folder's
nav.jsonand list the pages in the order you want inpages. Keep"..."at the end if you want any other pages to follow automatically. - Rename a section: set
titlein that folder'snav.json. - Add tabs: open the root
content/nav.jsonand add the names of your top-level folders to the existingtabsarray. Tabs appear in the order you list them, after the Home tab. Keep theapimatic:entries referred in tabs, or else they will all move into the Home sidebar (see built-in tabs).
{
"title": "Home",
"tabs": ["guides", "apimatic:sdks", "apimatic:plugin", "apimatic:api"],
"pages": ["index", "..."]
}- Rebuild your portal to see the changes.
Examples
Default portal
A new portal starts with this root nav.json. It shows SDKs, Context Plugins, and API Reference as tabs, and everything else in Home.
{
"tabs": ["apimatic:sdks", "apimatic:plugin", "apimatic:api"],
"pages": ["index", "..."]
}Nested folders
Each folder controls its own order. Here, guides contains a subfolder advanced with its own nav.json.
content/
guides/
nav.json
authentication.md
advanced/
nav.json
webhooks.md
rate-limits.md{
"title": "Guides",
"pages": ["authentication", "advanced"]
}Inside the nested advanced folder, nav.json looks something like this:
{
"title": "Advanced",
"pages": ["webhooks", "rate-limits"]
}