From 7993abe690e0d79e37e5a2ead76ebc24b98343ad Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Sat, 12 Feb 2022 23:48:21 +0800 Subject: [PATCH] docs: add the way to get the category tree in the theme development documentation (#37) Signed-off-by: Ryan Wang --- docs/developer-guide/theme/template-tag.md | 102 +++++++++++++++++ .../developer-guide/theme/template-tag.md | 108 +++++++++++++++++- 2 files changed, 207 insertions(+), 3 deletions(-) diff --git a/docs/developer-guide/theme/template-tag.md b/docs/developer-guide/theme/template-tag.md index 5849262..d798a2e 100644 --- a/docs/developer-guide/theme/template-tag.md +++ b/docs/developer-guide/theme/template-tag.md @@ -996,6 +996,108 @@ categories: name2(12) ``` +### 获取分类目录树结构(tree) + +#### 语法 + +```html +<@categoryTag method="tree"> +// do something + +``` + +参数: + +1. method:tree + +#### 返回参数 + +categories: + +```json +[ + { + "children": [ + { + "children": [], + "createTime": "2022-02-12T14:11:06.376Z", + "description": "string", + "fullPath": "string", + "id": 0, + "name": "string", + "parentId": 0, + "password": "string", + "slug": "string", + "thumbnail": "string" + } + ], + "createTime": "2022-02-12T14:11:06.376Z", + "description": "string", + "fullPath": "string", + "id": 0, + "name": "string", + "parentId": 0, + "password": "string", + "slug": "string", + "thumbnail": "string" + } +] +``` + +#### 示例 + +```html +<@categoryTag method="tree"> + + + +<#macro renderCategories categories> + + +``` + +输出: + +```html + +``` + ### 获取文章的所有分类(listByPostId) #### 语法 diff --git a/versioned_docs/version-1.4.17/developer-guide/theme/template-tag.md b/versioned_docs/version-1.4.17/developer-guide/theme/template-tag.md index 7ff3e23..d798a2e 100644 --- a/versioned_docs/version-1.4.17/developer-guide/theme/template-tag.md +++ b/versioned_docs/version-1.4.17/developer-guide/theme/template-tag.md @@ -996,6 +996,108 @@ categories: name2(12) ``` +### 获取分类目录树结构(tree) + +#### 语法 + +```html +<@categoryTag method="tree"> +// do something + +``` + +参数: + +1. method:tree + +#### 返回参数 + +categories: + +```json +[ + { + "children": [ + { + "children": [], + "createTime": "2022-02-12T14:11:06.376Z", + "description": "string", + "fullPath": "string", + "id": 0, + "name": "string", + "parentId": 0, + "password": "string", + "slug": "string", + "thumbnail": "string" + } + ], + "createTime": "2022-02-12T14:11:06.376Z", + "description": "string", + "fullPath": "string", + "id": 0, + "name": "string", + "parentId": 0, + "password": "string", + "slug": "string", + "thumbnail": "string" + } +] +``` + +#### 示例 + +```html +<@categoryTag method="tree"> + + + +<#macro renderCategories categories> + + +``` + +输出: + +```html + +``` + ### 获取文章的所有分类(listByPostId) #### 语法 @@ -1671,7 +1773,7 @@ teams: <#list teams as team>

${team.team}