Learn how to create sidebar with links, sections, and subsections.
Get started
Go to src/i18n/sidebar.ts, and inside SidebarSchema type you will define the shape of your sidebar content.
Each object property can be either string or section. If it’s string it’s just the link, but if it’s section, that’s collapsible section of links or sections.
Section have sectionName, and
sectionItems properties.
sectionName is title of the collapsible, and
sectionItems are it’s children which can be either link or a subsection.
Subsection have subsectionName, and
subsectionItems properties.
subsectionName is title of the collapsible, and
subsectionItems are it’s children which are links.
You should name each object property in this schema after the markdown file or folder name you will create.
Object properties in SidebarSchema should be named in kebab-case.
Each property value should be translation of that item.
This all probably sounds confusing, so I will show you few examples.
Examples
Only links
Now we set GET_STARTED_LINK to first link in the sidebar:
In this case you will create 5 markdown files in each lang folder and it will look like this:
And now you have a sidebar with 5 links!
Only sections
Now we set GET_STARTED_LINK to first link in the sidebar:
In this case you will create 2 folders with 3 files each, in each lang folder and it will look like this:
And now you have a sidebar with 2 sections with 3 links each!
Links and sections
Now we set GET_STARTED_LINK to first link in the sidebar:
In this case you will create 4 files and 2 folders with 3 files each, in each lang folder and it will look like this:
And now you have a sidebar with 4 links and 2 sections with 3 links each!
Subsections
Now we set GET_STARTED_LINK to first link in the sidebar:
In this case you will create 1 folder containing 2 files, and 2 subfolders with 2 files each, in each lang folder and it will look like this:
And now you have a sidebar with 1 section with 2 links, and 2 subsections with 2 links each!