跳到主要内容
版本:2.17

文章

路由信息

  • 模板路径:/templates/post.html
  • 访问路径:/archives/:slug

变量

post

变量类型

#PostVo

示例

/templates/post.html
<article>
  <h1 th:text="${post.spec.title}"></h1>
  <div th:utext="${post.content.content}"> </div>
</article>

_templateId

变量值

post

类型定义

CategoryVo

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

TagVo

TagVo
{
  "metadata": {
    "name": "string",                                   // 唯一标识
    "labels": {
      "additionalProp1": "string"
    },
    "annotations": {
      "additionalProp1": "string"
    },
    "creationTimestamp": "2022-11-20T13:06:38.512Z",    // 创建时间
  },
  "spec": {
    "displayName": "string",                            // 显示名称
    "slug": "string",                                   // 别名,通常用于生成 status.permalink
    "color": "#F9fEB1",                                 // 背景颜色
    "cover": "string"                                   // 封面图
  },
  "status": {
    "permalink": "string",                              // 固定链接
  },
  "postCount": 0                                        // 文章数量
}

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",  // 创建时间
  }
}

ContentVo

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

PostVo

PostVo
{
  "metadata": {
    "name": "string",                                   // 唯一标识
    "labels": {
      "additionalProp1": "string"
    },
    "annotations": {
      "additionalProp1": "string"
    },
    "creationTimestamp": "2022-11-20T12:45:43.888Z",    // 创建时间
  },
  "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"                                   // 摘要内容
    },
    "categories": [                                     // 分类的名称集合,即 Category 的 metadata.name 的集合
      "string"
    ],
    "tags": [                                           // 标签的名称集合,即 Tag 的 metadata.name 的集合
      "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"
    ]
  },
  "categories": "List<#CategoryVo>",                    // 分类的集合
  "tags": "List<#TagVo>",                               // 标签的集合
  "contributors": "List<#ContributorVo>",               // 贡献者的集合
  "owner": "#ContributorVo",                            // 创建者
  "stats": {
    "visit": 0,                                         // 访问数量
    "upvote": 0,                                        // 点赞数量
    "comment": 0                                        // 评论数量
  },
  "content": "#ContentVo"                               // 内容
}