跳到主要内容
版本:2.15

独立页面

getByName(pageName)

singlePageFinder.getByName(pageName)

描述

根据 metadata.name 获取独立页面。

参数

  1. pageName:string - 独立页面的唯一标识 metadata.name

返回值

#SinglePageVo

示例

<div th:with="singlePage = ${singlePageFinder.getByName('page-foo')}">
<a th:href="@{${singlePage.status.permalink}}" th:text="${singlePage.spec.title}"></a>
</div>

content(pageName)

singlePageFinder.content(pageName)

描述

根据独立页面的 metadata.name 单独获取独立页面内容。

参数

  1. pageName:string - 独立页面的唯一标识 metadata.name

返回值

#ContentVo

示例

<div th:with="content = ${singlePageFinder.content('page-foo')}">
<div th:utext="${content.content}"></div>
</div>

list(page,size)

singlePageFinder.list(page,size)

描述

根据分页参数获取独立页面列表。

参数

  1. page:int - 分页页码,从 1 开始
  2. size:int - 分页条数

返回值

#ListResult<ListedSinglePageVo>

示例

<ul th:with="singlePages = ${singlePageFinder.list(1,10)}">
<li th:each="singlePage : ${singlePages.items}">
<a th:href="@{${singlePage.status.permalink}}" th:text="${singlePage.spec.title}"></a>
</li>
</ul>

类型定义

SinglePageVo

SinglePageVo
{
"metadata": {
"name": "string", // 唯一标识
"labels": {
"additionalProp1": "string"
},
"annotations": {
"additionalProp1": "string"
},
"creationTimestamp": "2022-11-20T14:29:44.601Z", // 创建时间
},
"spec": {
"title": "string", // 标题
"slug": "string", // 别名,通常用于生成 status.permalink
"releaseSnapshot": "string",
"headSnapshot": "string",
"baseSnapshot": "string",
"owner": "string", // 创建者名称,即 ContributorVo 的 metadata.name,非显示名称
"template": "string", // 自定义渲染模板
"cover": "string", // 封面图
"deleted": false,
"publish": false,
"publishTime": "2022-11-20T13:06:38.505Z", // 发布时间
"pinned": false, // 是否置顶
"allowComment": true, // 是否允许评论
"visible": "PUBLIC",
"priority": 0,
"excerpt": {
"autoGenerate": true, // 是否自动生成摘要
"raw": "string" // 摘要内容
},
"htmlMetas": [
{
"additionalProp1": "string"
}
]
},
"status": {
"permalink": "string", // 固定链接
"excerpt": "string", // 最终生成的摘要
"inProgress": true,
"lastModifyTime": "2022-11-20T13:06:38.505Z", // 最后修改时间
"commentsCount": 0, // 评论数
"contributors": [ // 贡献者名称,Contributor 的 metadata.name 的集合
"string"
]
},
"stats": {
"visit": 0, // 访问数量
"upvote": 0, // 点赞数量
"comment": 0 // 评论数量
},
"contributors": "List<#ContributorVo>", // 贡献者的集合
"owner": "#ContributorVo", // 创建者
"content": "#ContentVo" // 内容
}

ListedSinglePageVo

ListedSinglePageVo
{
"metadata": {
"name": "string", // 唯一标识
"labels": {
"additionalProp1": "string"
},
"annotations": {
"additionalProp1": "string"
},
"creationTimestamp": "2022-11-20T14:31:00.876Z" // 创建时间
},
"spec": {
"title": "string", // 标题
"slug": "string", // 别名,通常用于生成 status.permalink
"releaseSnapshot": "string",
"headSnapshot": "string",
"baseSnapshot": "string",
"owner": "string", // 创建者名称,即 ContributorVo 的 metadata.name,非显示名称
"template": "string", // 自定义渲染模板
"cover": "string", // 封面图
"deleted": false,
"publish": false,
"publishTime": "2022-11-20T14:31:00.876Z", // 发布时间
"pinned": false, // 是否置顶
"allowComment": true, // 是否允许评论
"visible": "PUBLIC",
"priority": 0,
"excerpt": {
"autoGenerate": true, // 是否自动生成摘要
"raw": "string" // 摘要内容
},
"htmlMetas": [
{
"additionalProp1": "string"
}
]
},
"status": {
"permalink": "string", // 固定链接
"excerpt": "string", // 最终生成的摘要
"inProgress": true,
"lastModifyTime": "2022-11-20T13:06:38.505Z", // 最后修改时间
"commentsCount": 0, // 评论数
"contributors": [ // 贡献者名称,Contributor 的 metadata.name 的集合
"string"
]
},
"stats": {
"visit": 0, // 访问数量
"upvote": 0, // 点赞数量
"comment": 0 // 评论数量
},
"contributors": "List<#ContributorVo>", // 贡献者的集合
"owner": "#ContributorVo" // 创建者
}

ListResult<ListedSinglePageVo>

ListResult<ListedSinglePageVo>
{
"page": 0, // 当前页码
"size": 0, // 每页条数
"total": 0, // 总条数
"items": "List<#ListedSinglePageVo>", // 自定义页面列表数据
"first": true, // 是否为第一页
"last": true, // 是否为最后一页
"hasNext": true, // 是否有下一页
"hasPrevious": true, // 是否有上一页
"totalPages": 0 // 总页数
}

ContentVo

ContentVo
{
"raw": "string", // 原始文本,一般用于给编辑器使用
"content": "string" // 最终渲染的文本
}

ContributorVo

ContributorVo
{
"name": "string", // 用户名
"displayName": "string", // 显示名称
"avatar": "string", // 头像
"bio": "string", // 描述
"permalink": "string", // 作者的文章归档页面链接
"metadata": {
"name": "string", // 唯一标识
"labels": {
"additionalProp1": "string"
},
"annotations": {
"additionalProp1": "string"
},
"creationTimestamp": "2022-11-20T13:06:38.512Z", // 创建时间
}
}