Customizing the sidebar¤
Material for nbdev makes it easy to customize the navigation in your project. You can modify the menu items by adding, deleting, or renaming them.
Renaming menu items¤
You can change the names of the API
, CLI
, and Releases
menu items
by editing the mkdocs/summary_template.txt
file. This file is used to
define the structure of your project’s documentation.
Now, lets change navigation structure of our nbdev_mkdocs_tutorial
project. We are going to rename the API
menu to Reference
in the
sidebar. Please run the following command from the root directory of
your project to open the file:
vi mkdocs/summary_template.txt
and replace the below line from - API
to - Reference
.
After making the change, the file will look like this:
{sidebar}
- Reference
{api}
- CLI
{cli}
- [Releases]{changelog}
Save the file, stop the server and re-run the nbdev_mkdocs preview
command to preview your changes.
Now, the documentation should look like this:
Removing menu items¤
You can also remove items from the side navigation in your project documentation. For example, let’s say you want to remove the CLI menu. You can do this by modifying the same file.
Please run the following command from the root directory of your project to open the file:
vi mkdocs/summary_template.txt
and delete the below lines
- CLI
{cli}
After making the change, the file will look like this:
{sidebar}
- Reference
{api}
- [Releases]{changelog}
Save the file, stop the server and re-run the nbdev_mkdocs preview
command to preview your changes.
Now, the documentation should look like this: