跳到主要内容

dinosaurs 导航栏配置

创建新的导航栏​

以创建前端导航栏为例子:

创建文件夹和对应文件​

创建front文件夹,创建intro.md文件,也可以创建文件夹比如html

文档目录
docs/
├── ...
├── front/
│ ├── intro.md
│ ├── _category_.json
│ ├── ...
│ └── html/
│ └── html_start.md
└── ...

修改配置文件​

docusaurus.config.ts
themeConfig: {
...
navbar: {
...
items: [
...
{
type: 'docSidebar',
sidebarId: 'frontSidebar',
position: 'left',
label: '前端',
},

],
},
}

注意:sidebarId: 'frontSidebar'和下面的frontSidebar要对应上

sidebars.ts
const sidebars: SidebarsConfig = {
...
frontSidebar: [{type: 'autogenerated', dirName: 'front'},],

};

控制在docs中的显示​

创建docs/front/_category_.json文件,用于显示该

docs/front/_category_.json
{
"label": "Tutorial - Basics",
"position": 2,
"link": {
"type": "generated-index",
"description": "5 minutes to learn the most important Docusaurus concepts."
}
}