跳到主要内容

索引页

卡片列表

您可以使用 DocCardList 组件将生成的卡片列表嵌入到普通文档页面中。它将显示当前文档的父类别的所有侧边栏项目。

mddocs/sidebar/index.md
import DocCardList from '@theme/DocCardList';

<DocCardList />

渲染:

目录配置文件

在相应的文件夹中添加 _category_.json_category_.yml 文件。您可以指定任何类别元数据以及位置元数据。label、className、position 和 customProps 将默认为类别链接文档的相应值(如果有)。

jsondocs/tutorials/_category_.json
{
"position": 2.5,
"label": "Tutorial",
"collapsible": true,
"collapsed": false,
"className": "red",
"link": {
"type": "generated-index",
"title": "Tutorial overview"
},
"customProps": {
"description": "This description can be used in the swizzled DocCard"
}
}

数字前缀

为了更易于采用,Docusaurus 支持多种数字前缀模式。 01-*.md01_*.md01.*.md ,默认情况下,Docusaurus 将从文档 ID、标题、标签和 URL 路径中删除数字前缀。