Navigation
This documentation is for the preview version of the Dev Portal. If you are using the legacy developer portal, please refer to the docs.
Dev Portal uses a single navigation
array to control both the top navigation tabs and the sidebar. Items at the root of this array appear as tabs, and nested items build the sidebar tree. Navigation entries can be links, document references, categories or custom pages.
Basic configuration
The navigation is defined using the navigation
array in the Dev Portal config file. Each item can be one of several types. At the simplest level you may only have links and categories.
Code(json)
Navigation Items
Navigation items can be of these types: category
, doc
, link
, or custom-page
.
link
: A direct link to a page or external URL.category
: A group of links that can be expanded or collapsed.doc
: A reference to a document by it file path:file
.custom-pages
: A custom page that is made of a React component, see Custom Pages
type: link
link
is the most basic item, it directly links to a path or URL. Use this for external resources or standalone pages.
Code(json)
TypeScript type declaration
Code(ts)
type: category
The category
type groups related items under a collapsible section. The label
is the displayed text, and the items
array contains id
s of documents, links, or other categories.
Code(json)
TypeScript type declaration
Code(ts)
type: doc
Doc is used to reference markdown files. The label
is the text that will be displayed, and the id
is the file path associated with a markdown file.
Code(json)
TypeScript type declaration
Code(ts)
Using shorthands
Documents can be referenced as strings (using their file path), which is equivalent to { "type": "doc", "file": "path" }
:
Code(json)
This is much more concise when you don't need custom labels, icons, or other properties for individual documents.
Learn more in the Markdown documentation
Custom paths
The path
property allows you to customize the URL path for a document. By default, Dev Portal uses the file path to generate the URL, but you can override this behavior by specifying a custom path.
Code(json)
Path
The path
property allows you to customize the URL path for a document. By default, Dev Portal uses the file path to generate the URL, but you can override this behavior by specifying a custom path.
Icons
Icons can be added to categories and documents by specifying an icon
property. The value should be the name of a Lucide icon (e.g., book
, code
, file-text
).
Code(json)
They can also be set on individual documents in their front matter:
Code(md)
Title & Labels
All navigation items can have a label
property that determines the displayed text. For doc
items, the label
is optional; if omitted, Dev Portal uses the document's title
from its front matter or the first #
header.
To override the navigation label without changing the document's title
, use the sidebar_label
property in the front matter:
Code(md)
In this example, the document's title remains "My Long Title," but the sidebar displays "Short Title."