mirror of
https://github.com/halo-dev/docs.git
synced 2026-01-14 07:02:53 +08:00
1.9 KiB
1.9 KiB
title, description
| title | description |
|---|---|
| 文章 | post.html - /archives/:slug |
import CategoryVo from "../vo/_CategoryVo.md" import TagVo from "../vo/_TagVo.md" import ContentVo from "../vo/_ContentVo.md" import ContributorVo from "../vo/_ContributorVo.md" import PostVo from "../vo/_PostVo.md"
文章详情页面的模板。
路由信息
- 模板路径:
/templates/post.html - 访问路径:默认为
/archives/:slug,用户可手动更改为其他路由形式,可参考:主题路由设置
自定义模板
除了上面提到的 post.html,主题作者还可以添加多种形式的额外渲染模板,提供给用户选择,此举可以丰富网站的使用类型,用户设置方式可参考 文章设置。
定义方式为:
customTemplates:
post:
- name: {name}
description: {description}
screenshot: {screenshot}
file: {file}.html
name:模板名称description:模板描述screenshot:模板预览图file:模板文件名,需要在/templates/目录下创建
示例:
customTemplates:
post:
- name: 文档
description: 文档类型的文章
screenshot:
file: post_documentation.html
:::info 需要注意,修改 theme.yaml 需要重载主题配置。 :::
变量
post
变量类型
示例
<article>
<h1 th:text="${post.spec.title}"></h1>
<div th:utext="${post.content.content}"> </div>
</article>
_templateId
变量值
post