mirror of
https://github.com/halo-dev/docs.git
synced 2025-10-24 02:56:35 +00:00
1.8 KiB
1.8 KiB
title, description
| title | description |
|---|---|
| 单页面 | page.html - /:slug |
import SinglePageVo from "../vo/_SinglePageVo.md" import ContributorVo from "../vo/_ContributorVo.md" import ContentVo from "../vo/_ContentVo.md"
页面与文章类似,同样包含页面标题和富文本形式的页面内容。与文章不同的是页面无法设置所属分类和标签信息,一般用于站点中单一展示功能的页面,例如常见的站点关于页面、联系我们页面等。
路由信息
- 模板路径:
/templates/page.html - 访问路径:
/:slug
自定义模板
除了上面提到的 page.html,主题作者还可以添加多种形式的额外渲染模板,提供给用户选择,此举可以丰富网站的使用类型。
定义方式为:
customTemplates:
page:
- name: {name}
description: {description}
screenshot: {screenshot}
file: {file}.html
name:模板名称description:模板描述screenshot:模板预览图file:模板文件名,需要在/templates/目录下创建
示例:
customTemplates:
page:
- name: 关于公司
description: 用于展示公司的一些信息
screenshot:
file: page_about.html
:::info 需要注意,修改 theme.yaml 需要重载主题配置。 :::
变量
singlePage
变量类型
示例
<article>
<h1 th:text="${singlePage.spec.title}"></h1>
<div th:utext="${singlePage.content.content}"> </div>
</article>
_templateId
变量值
page