创建文档
文档是由以下方式串联起来的页面集合:
- 侧边栏
- 上一页/下一页导航
- 版本管理
创建你的第一篇文档
新建 Markdown 文件 docs/hello.md:
docs/hello.md
# Hello
This is my **first Docusaurus document**!
新文档可通过 http://localhost:3000/docs/hello 访问。
配置侧边栏
Docusaurus 会根据 docs 文件夹自动生成侧边栏。
通过添加 frontmatter 元数据自定义侧边栏标签和位置:
docs/hello.md
---
sidebar_label: 'Hi!'
sidebar_position: 3
---
# Hello
This is my **first Docusaurus document**!
也可以在 sidebars.js 中手动显式定义侧边栏:
sidebars.js
export default {
tutorialSidebar: [
'intro',
'hello',
{
type: 'category',
label: 'Tutorial',
items: ['tutorial-basics/create-a-document'],
},
],
};