mirror of
https://github.com/halo-dev/docs.git
synced 2025-10-21 18:24:58 +00:00
完善 Halo 2.0 主题开发的文档。 /kind documentation Fixes https://github.com/halo-dev/docs/issues/109 TODO list: - [x] 准备工作 - 提供从搭建 Halo 开发环境到成功应用一个新的主题的过程。 - [x] 目录结构 - 详细解释一个主题的目录构成,包括每一个目录和文件的作用。 - [x] 配置文件 - 提供 `theme.yaml` 的各个配置的解释。 - [x] 设置选项 - 讲解如何在主题模板中使用主题定义的 `settings.yaml` 配置项。**注意:关于 settings.yaml 或许可以单独出一篇文档,因为插件也需要用到。主题和插件的文档只需要单独讲解如何使用** - [x] 静态资源 - 讲解静态资源的引用。 - [x] 核心路由 - 列出 Halo 核心提供的路由以及模板,其中需要包括 `文章/自定义页面/分类的自定义模板` 的讲解 - [x] 模板变量 - 讲解系统内提供的路由对应模板中包含的变量。 - [x] Finder APIs - 讲解数据获取 API 的使用。 - [x] 常用代码片段 - 提供一些在主题开发中常用的代码片段,比如如何定义一个 `layout.html`,如何结构化渲染一个菜单或者文章分类等。 ```release-note None ```
3.0 KiB
3.0 KiB
title, description
| title | description |
|---|---|
| 文章 | post.html - /archives/:slug |
路由信息
- 模板路径:
/templates/post.html - 访问路径:
/archives/:slug
变量
post
变量类型
示例
<article>
<h1 th:text="${post.spec.title}"></h1>
<div th:utext="${post.content.content}"> </div>
</article>
_templateId
变量值
post
类型定义
CategoryVo
{
"metadata": {
"name": "string",
"labels": {
"additionalProp1": "string"
},
"annotations": {
"additionalProp1": "string"
},
"creationTimestamp": "2022-11-20T13:06:38.512Z",
},
"spec": {
"displayName": "string",
"slug": "string",
"description": "string",
"cover": "string",
"template": "string",
"priority": 0,
"children": [
"string"
]
},
"status": {
"permalink": "string",
"postCount": 0,
"visiblePostCount": 0
},
"postCount": 0
}
TagVo
{
"metadata": {
"name": "string",
"labels": {
"additionalProp1": "string"
},
"annotations": {
"additionalProp1": "string"
},
"creationTimestamp": "2022-11-20T13:06:38.512Z",
},
"spec": {
"displayName": "string",
"slug": "string",
"color": "#F9fEB1",
"cover": "string"
},
"status": {
"permalink": "string",
"visiblePostCount": 0,
"postCount": 0
},
"postCount": 0
}
PostVo
{
"metadata": {
"name": "string",
"labels": {
"additionalProp1": "string"
},
"annotations": {
"additionalProp1": "string"
},
"creationTimestamp": "2022-11-20T12:45:43.888Z",
},
"spec": {
"title": "string",
"slug": "string",
"releaseSnapshot": "string",
"headSnapshot": "string",
"baseSnapshot": "string",
"owner": "string",
"template": "string",
"cover": "string",
"deleted": false,
"publish": false,
"publishTime": "2022-11-20T12:45:43.888Z",
"pinned": false,
"allowComment": true,
"visible": "PUBLIC",
"priority": 0,
"excerpt": {
"autoGenerate": true,
"raw": "string"
},
"categories": [
"string"
],
"tags": [
"string"
],
"htmlMetas": [
{
"additionalProp1": "string"
}
]
},
"status": {
"permalink": "string",
"excerpt": "string",
"commentsCount": 0,
"contributors": [
"string"
]
},
"categories": "List<#CategoryVo>",
"tags": "List<#TagVo>",
"contributors": [
{
"name": "string",
"displayName": "string",
"avatar": "string",
"bio": "string"
}
],
"owner": {
"name": "string",
"displayName": "string",
"avatar": "string",
"bio": "string"
},
"stats": {
"visit": 0,
"upvote": 0,
"comment": 0
},
"content": {
"raw": "string",
"content": "string"
}
}