Navigation
Configuring navigation elements
Adding Links to Layouts
You can display links by customising the links
option of layouts.
Link Item
A link to navigate to a URL/href, can be external.
Active Mode
The conditions to be marked as active.
Mode | Description |
---|---|
url | When browsing the specified url |
nested-url | When browsing the url and its child pages like /blog/post |
none | Never be active |
Secondary
Set the item as secondary, secondary items will be displayed differently on navbar.
Filter
You can restrict where the item is displayed.
Icon Item
Same as link item, but is shown as an icon button on navbar. Icon items are secondary by default.
Button Item
Same as link item, but is shown as a button.
Navigation Menu
A navigation menu containing link items.
Note that the description
field will only be displayed on the navbar in Home Layout.
Custom Item
Display a custom component.
GitHub Url
There's also a shortcut for adding GitHub repository link item.
Customise Sidebar
You can customise all navigation elements with Page Tree, a tree that describes all available pages.
It can be hardcoded, or generated from your file structure for content sources like Fumadocs MDX. See Organizing Pages to learn how to customise the generated page tree.
Pass it to the Docs Layout component:
Others
Document Search
Search is also an important way to navigate between pages, you can refer to Search to learn more about configuring document search.
Hierarchy
Hierarchy can create an intuition to users, Fumadocs UI is designed in:
-
Layout links should redirect the user to another layout, like the blog page or landing page.
-
A sidebar can have multiple tabs, each tab opens a different tree of navigation links.
-
The active page tree will be shown on navigation elements like sidebar, allowing users to switch between pages.
-
The page shows its content, with elements like Table of Contents to improve the reading experience.
Nodes should not impact their upper nodes (ancestors). For example, clicking a page tree item on sidebar should not change the root of page tree.
Changing Routes
The default routing structure of your docs can also be changed as it is essentially a Next.js app.
Remove the docs layout of a certain page
The /docs/[[...slug]]
route is a catch-all route.
To use another layout for a certain page, move the page outside the app/docs
folder, to a place that's accessible with the same base route /docs
.
This is possible using Next.js Route Group. For example, adding a /docs
page without docs layout.
Ensure there's no duplicated page with the same URL in the catch-all route [[...slug]]/page.tsx
.
In the above example, a MDX file with the path content/docs/index.mdx
will produce errors.
FAQ
Multi versions
Use a separate deployment for each version.
On Vercel, this can be done by creating another branch for a specific version on your GitHub repository. To link to the sites of other versions, use the Links API or a custom navigation component.
Multi Docs
See Multiple Page Trees.
How is this guide?