Docusaurus 侧边栏详解
· 阅读需 22 分钟
Docusaurus 侧边栏详解
程序员 101:Read The Fucking Manual
缘起
important
当前最新 docusaurus 版本为 3.5.2,笔者觉得目前 docusaurus 的侧边栏有些细枝末节还是很混乱,希望后期可以改进
起因是笔者最近看了一些博客,并且做了几个小组件,想在 Navbar 中添加一个新的链接指向 snippet 即一个代码片段的页面。经过一些研究,发现大部分作者,以及 FaceBook 官方使用的方法都是在 doc 中添加一个新的文件夹,并为其创建一个新的 sidebar,但笔者在刚接触 docusaurus 时并没有去研究过这个 sidebar 的具体内容,并且有点急于求成,脑子越来越乱。查资料过程中又发现了新的功能,整理一下所有内容,记录一下整个的心路历程
提示
建议有兴趣的读者,先完整读一遍,笔者会进行详细的分析,并在最后给出推荐的配置,没必要一步一步跟着试错
侧边栏 root
侧边栏 root 指的是侧边栏中,这种能折叠的页面:
这种页面在文档中起的作用很显而易见,即将文档分类,方便读者查找。不仅如此,在阅读官方文档时,还发现了一个新的功能:提供一个页面的总结