Sidebar (docs.json)
When exporting Feishu Pages, a docs.json
file is generated according to the original directory structure of Feishu Knowledge Base, so that when we need to use it in various Static Page Generators, we can simply build a custom directory tree through docs.json
.
Each Static Page Generator automatically builds a directory tree in a different way, such as the one I know:
- MdBook, GitBook - Generated based on
SUMMARY.md
. - VitePress - Default hierarchy based on
.md
files, supports custom Sidebar . - Docusaurus - Default based on
.md
file structure, supports custom Sidebar .
Basically, most tools support generating Sidebars according to directory structure, but in reality, there are some minor differences between them.
Therefore, Feishu Pages gives docs.json
so that when we use it, we can manually generate it to reduce the pit.
File structure
The docs.json
file is a JSON file that stores the complete tree structure of the entire document in a hierarchical manner.
Field | Type | Description |
depth | interger | Directory depth, starting from 0, + 1 for each layer |
title | string | Document Title |
children | array | Subset documents, each member has the same Doc structure as described in this table |
has_child | bool | Whether to include subset documents, true | false |
meta | object | See the PageMeta description below, generated by PageMeta in the document |
position | Arrangement order | The small one is in the front (in fact, the structure of the array is already in the original order). You can ignore this field. |
filename | string | File name of Markdown |
node_token | string | Raw fields for Feishu API |
parent_node_token | string | Raw fields for Feishu API |
obj_token | string | Raw fields for Feishu API |
obj_create_time | string | Document creation time for Unix Timestamp, Feishu API raw field |
obj_edit_time | string | Document modification time for Unix Timestamp, Feishu API raw field |
For example
[
{
// 目录深度
"depth": 0,
// 页面标题
"title": "简体中文",
// _token 结尾的为
"node_token": "PRqjwjB4EiQbiEk5fxVc99BZnzg",
"parent_node_token": "",
"obj_create_time": "1697445178",
"obj_edit_time": "1698232747",
"obj_token": "LmzFdNtLQok47MxMUagc2o9SnXc",
"children": [
{
"depth": 1,
"title": "快速开始",
"node_token": "XpKYwA6oqiGMfFkLVwCcwykunzV",
"parent_node_token": "PRqjwjB4EiQbiEk5fxVc99BZnzg",
"obj_create_time": "1693452885",
"obj_edit_time": "1698229707",
"obj_token": "Fkoed2dB5ofvJbxSmZbcWMBhnQd",
"children": [],
"has_child": false,
"meta": {
"slug": "gettting-started"
},
"slug": "zh-CN/gettting-started",
"position": 0,
"filename": "zh-CN/gettting-started.md"
},
{
"depth": 1,
"title": "支持的内容格式",
"node_token": "Ks7jwPEtJiyUXckawcRcJ68jnvg",
"parent_node_token": "PRqjwjB4EiQbiEk5fxVc99BZnzg",
"obj_create_time": "1695107050",
"obj_edit_time": "1698225722",
"obj_token": "Z1dpdj9Y5o0IEex5fecc529qnwc",
"children": [
// ...
],
"has_child": true,
"meta": {
"slug": "supported-formats"
},
"slug": "zh-CN/supported-formats",
"position": 1,
"filename": "zh-CN/supported-formats.md"
}
]
}
]