跳到主要内容
版本:2.15

文章分类集合

路由信息

  • 模板路径:/templates/categories.html
  • 访问路径:/categories

变量

categories

变量类型

List<#CategoryTreeVo>

示例

/templates/categories.html
<ul>
<li th:replace="~{modules/category-tree :: single(categories=${categories})}" />
</ul>
/templates/category-tree.html
<ul th:fragment="next (categories)">
<li th:fragment="single (categories)" th:each="category : ${categories}">
<a th:href="@{${category.status.permalink}}">
<span th:text="${category.spec.displayName}"> </span>
</a>
<th:block th:if="${not #lists.isEmpty(category.children)}">
<th:block th:replace="~{modules/category-tree :: next (categories=${category.children})}"></th:block>
</th:block>
</li>
</ul>

_templateId

变量值

categories

类型定义

CategoryTreeVo

CategoryTreeVo
{
"metadata": {
"name": "string", // 唯一标识
"labels": {
"additionalProp1": "string"
},
"annotations": {
"additionalProp1": "string"
},
"creationTimestamp": "2022-11-20T14:18:49.230Z", // 创建时间
},
"spec": {
"displayName": "string", // 显示名称
"slug": "string", // 别名,通常用于生成 status.permalink
"description": "string", // 描述
"cover": "string", // 封面图
"template": "string", // 自定义渲染模板名称
"priority": 0, // 排序字段
"children": [ // 下级分类,分类的 metadata.name 集合
"string"
]
},
"status": {
"permalink": "string", // 固定链接
"postCount": 0, // 文章数
"visiblePostCount": 0 // 已发布文章数
},
"children": "List<#CategoryTreeVo>", // 下级分类,CategoryTreeVo 的集合
"parentName": "string",
"postCount": 0
}