The navigation property in docs.json controls the structure and information hierarchy of your documentation.
With proper navigation configuration, you can organize your content so that users can find exactly what they're looking for.
Choose one primary organizational pattern at the root level of your navigation. Once you've chosen your primary pattern, you can nest other navigation elements within it.
Pages
Pages are the most fundamental navigation component. Each page is an MDX file in your documentation repository.
In the navigation object, pages is an array where each entry must reference the path to a page file.
Groups
Use groups to organize your sidebar navigation into sections. You can nest groups within each other, label them with tags, and style them with icons.
In the navigation object, groups is an array where each entry is an object that requires a group field and a pages field. The icon, tag, root, and expanded fields are optional.
Root page
Use the root property to designate a main page for a group. When a group has a root page, clicking the group title in the sidebar navigation opens the root page. Root pages work for top-level and nested groups.
Directory listings
Use the directory property to automatically render a directory of child pages and groups on group root pages. When you set directory on any object within the navigation tree in docs.json, groups with a root page matching or beneath that object display a listing of their pages and groups below their page contents.
The directory property accepts three values:
| Value | Behavior |
|---|---|
"none" | No directory listing. Default value. |
"accordion" | Displays child pages in a collapsible list grouped by section. |
"card" | Displays child pages in a horizontal card layout. |
The directory value inherits recursively through the navigation tree. Set it on anywhere within the navigation object and all descendant groups inherit the same value. Any descendant can override the inherited value by setting directory to a different value.
You can set directory anywhere in the navigation object in your docs.json file, including on tabs, anchors, dropdowns, products, versions, languages, and individual groups.
In this example:
- Help Center uses
"accordion"and its root page displays a directory listing. - Getting Started inherits
"accordion"from its parent and also displays a directory listing. - API Reference overrides with
"none", so its root page does not display a directory listing.
The directory property only affects groups that have a root page. Groups without a root page are not affected.
Default expanded state
Use the expanded property to control the default state of a nested group in the navigation sidebar.
expanded: true: Expands the group by default.expanded: falseor omitted: Collapses the group by default.
The expanded property only affects nested groups--groups within groups. Top-level groups always expand and you cannot collapse them.
Tabs
Tabs create distinct sections of your documentation with separate URL paths. Tabs create a horizontal navigation bar at the top of your documentation that lets users switch between sections.
In the navigation object, tabs is an array where each entry is an object that requires a tab field and can contain other navigation fields such as groups, pages, icons, or links to external pages.
Menus
Menus add dropdown navigation items to a tab. Use menus to help users go directly to specific pages within a tab.
In the navigation object, menu is an array where each entry is an object that requires an item field and can contain other navigation fields such as groups, pages, icons, or links to external pages.
Menu items can only contain groups, pages, and external links.
Anchors
Anchors add persistent navigation items to the top of your sidebar. Use anchors to section your content, provide quick access to external resources, or create prominent calls to action.
In the navigation object, anchors is an array where each entry is an object that requires an anchor field and can contain other navigation fields such as groups, pages, icons, or links to external pages.
Global anchors
Use global anchors for links that should appear on all pages, regardless of which section of your navigation the user is viewing. Global anchors are useful for linking to resources outside your documentation, such as a blog, community forum, or support portal. They also provide consistent access to important internal pages, such as a changelog or status page.
Global anchors support both external URLs and relative paths to pages within your documentation.
Products
Products create a dedicated navigation division for organizing product-specific documentation. Use products to separate different offerings, services, or major feature sets within your documentation.
In the navigation object, products is an array where each entry is an object that requires a product field and can contain other navigation fields such as groups, pages, icons, or links to external pages.
Dropdowns
Dropdowns are an expandable menu at the top of your sidebar navigation. Each item in a dropdown directs to a section of your documentation.
In the navigation object, dropdowns is an array where each entry is an object that requires a dropdown field and can contain other navigation fields such as groups, pages, icons, or links to external pages.
OpenAPI
Integrate OpenAPI specifications directly into your navigation structure to automatically generate API documentation. Create dedicated API sections or place endpoint pages within other navigation components.
Set a default OpenAPI specification at any level of your navigation hierarchy. Child elements inherit the specification unless they define their own.
When you add the openapi property to a navigation element (such as an anchor, tab, or group) without specifying any pages, Docfiy automatically generates pages for all endpoints defined in your OpenAPI specification.
To control which endpoints appear, explicitly list the desired endpoints in a pages array.
For more information about referencing OpenAPI endpoints in your docs, see the OpenAPI setup.
Versions
Partition your navigation into different versions. Versions are selectable from a dropdown menu.
In the navigation object, versions is an array where each entry is an object that requires a version field and can contain any other navigation fields.
Default version
Docfiy uses the first version in the versions array as the default. Use the default field to specify a different version as the default.
Version tags
Add a badge label to version entries in the version selector dropdown using the optional tag field. Use tags to highlight specific versions such as "Latest," "Recommended," or "Beta."
Languages
Partition your navigation into different languages. Languages are selectable from a dropdown menu.
In the navigation object, languages is an array where each entry is an object that requires a language field and can contain any other navigation fields, including language-specific banner, footer, and navbar configurations.
We currently support the following languages for localization:
| Language | Code |
|---|---|
| Arabic | ar |
| Catalan | ca |
| Chinese | cn |
| Chinese (Traditional) | zh-Hant |
| Czech | cs |
| Danish | da |
| Dutch | nl |
| English | en |
| Finnish | fi |
| French | fr |
| German | de |
| Hebrew | he |
| Hindi | hi |
| Hungarian | hu |
| Indonesian | id |
| Italian | it |
| Japanese | jp |
| Korean | ko |
| Latvian | lv |
| Norwegian | no |
| Polish | pl |
| Portuguese (Brazil) | pt-BR |
| Romanian | ro |
| Russian | ru |
| Spanish | es |
| Swedish | sv |
| Turkish | tr |
| Ukrainian | uk |
| Uzbek | uz |
| Vietnamese | vi |
For automated translations, set up an automation to run the agent on a schedule or in response to repository pushes.
Nesting
You can nest navigation elements within each other to create complex hierarchies. You must have one root-level parent navigation element such as tabs, groups, or a dropdown. You can nest other types of navigation elements within your primary navigation pattern.
Each navigation element can contain one type of child element at each level of your navigation hierarchy. For example, a tab can contain anchors that contain groups, but a tab cannot contain both anchors and groups at the same level.
Breadcrumbs
Breadcrumbs display the full navigation path at the top of pages. Some themes have breadcrumbs enabled by default and others do not. You can control whether breadcrumbs display on your site using the styling property in your docs.json.
Interaction configuration
Control how users interact with navigation elements using the interaction property in your docs.json.
Enable auto-navigation for groups
When a user expands a navigation group, some themes automatically navigate to the first page in the group. You can override a theme's default behavior using the drilldown option.
- Set to
trueto force automatic navigation to the first page when a user selects a navigation group. - Set to
falseto prevent navigation and only expand or collapse the group when a user selects a navigation group. - Leave unset to use the theme's default behavior.