docs: update documentation for Halo 2.12 (#306)

为 Halo 2.12.0 更新文档。

/kind documentation

```release-note
None 
```
This commit is contained in:
Ryan Wang
2024-02-01 11:11:39 +08:00
committed by GitHub
parent 2ebc8ca714
commit d0ea59e6e2
165 changed files with 13474 additions and 254 deletions

View File

@@ -0,0 +1,58 @@
---
title: 全局变量
description: 本文档介绍 Halo 为模板引擎提供的专有全局变量。
---
import SiteSettingVo from "./vo/SiteSettingVo.md"
import ThemeVo from "./vo/ThemeVo.md"
Halo 目前为模板引擎在全局提供了一些变量,本文档将列出已提供的变量以及介绍这些变量的使用方法。
## site
### 描述
提供了部分可公开的系统相关的设置项,其中所有参数均来自于 Console 的系统设置。
### 类型
<SiteSettingVo />
### 示例
显示站点标题:
```html
<h1 th:text="${site.title}"></h1>
```
显示站点 Logo
```html
<img th:src="${site.logo}" alt="Logo" />
```
## theme
### 描述
关于当前激活主题的信息。
### 类型
<ThemeVo />
### 示例
显示主题名称:
```html
<h1 th:text="${theme.spec.displayName}"></h1>
```
在静态资源加入版本号参数,以防止升级之后的缓存问题:
```html
<link rel="stylesheet" th:href="@{/assets/dist/style.css?v={version}(version=${theme.spec.version})}" />
<script th:src="@{/assets/dist/main.iife.js?v={version}(version=${theme.spec.version})}"></script>
```