2024-12-31 00:34:20 +00:00
|
|
|
|
---
|
|
|
|
|
title: 其他短代码
|
|
|
|
|
linkTitle: 其他
|
2025-08-14 23:49:06 +08:00
|
|
|
|
next: /docs/guide/deploy-site
|
2024-12-31 00:34:20 +00:00
|
|
|
|
---
|
|
|
|
|
|
2025-08-22 00:31:16 +02:00
|
|
|
|
{{< callout type="warning" >}}
|
2025-08-14 23:49:06 +08:00
|
|
|
|
其中部分为Hugo内置短代码。
|
|
|
|
|
这些短代码稳定性较低,可能随时变更。
|
2024-12-31 00:34:20 +00:00
|
|
|
|
{{< /callout >}}
|
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
### 示例
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
{{< badge "default" >}}
|
|
|
|
|
{{< badge content="border" border=false >}}
|
|
|
|
|
{{< badge content="color" color="green" >}}
|
|
|
|
|
{{< badge content="link" link="https://github.com/imfing/hextra/releases" >}}
|
|
|
|
|
{{< badge content="icon" icon="sparkles" >}}
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
### 使用
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
#### 默认
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
{{< badge "徽章" >}}
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
|
|
|
|
```
|
2025-08-23 15:42:23 +02:00
|
|
|
|
{{</* badge "徽章" */>}}
|
2024-12-31 00:34:20 +00:00
|
|
|
|
```
|
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
#### 颜色
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
{{< badge content="徽章" >}}
|
|
|
|
|
{{< badge content="徽章" color="purple" >}}
|
|
|
|
|
{{< badge content="徽章" color="indigo" >}}
|
|
|
|
|
{{< badge content="徽章" color="blue" >}}
|
|
|
|
|
{{< badge content="徽章" color="green" >}}
|
|
|
|
|
{{< badge content="徽章" color="yellow" >}}
|
|
|
|
|
{{< badge content="徽章" color="amber" >}}
|
|
|
|
|
{{< badge content="徽章" color="orange" >}}
|
|
|
|
|
{{< badge content="徽章" color="red" >}}
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
```
|
|
|
|
|
{{</* badge content="徽章" */>}}
|
|
|
|
|
{{</* badge content="徽章" color="purple" */>}}
|
|
|
|
|
{{</* badge content="徽章" color="indigo" */>}}
|
|
|
|
|
{{</* badge content="徽章" color="blue" */>}}
|
|
|
|
|
{{</* badge content="徽章" color="green" */>}}
|
|
|
|
|
{{</* badge content="徽章" color="yellow" */>}}
|
|
|
|
|
{{</* badge content="徽章" color="amber" */>}}
|
|
|
|
|
{{</* badge content="徽章" color="orange" */>}}
|
|
|
|
|
{{</* badge content="徽章" color="red" */>}}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
{{< badge content="徽章" border=false >}}
|
|
|
|
|
{{< badge content="徽章" color="purple" border=false >}}
|
|
|
|
|
{{< badge content="徽章" color="indigo" border=false >}}
|
|
|
|
|
{{< badge content="徽章" color="blue" border=false >}}
|
|
|
|
|
{{< badge content="徽章" color="green" border=false >}}
|
|
|
|
|
{{< badge content="徽章" color="yellow" border=false >}}
|
|
|
|
|
{{< badge content="徽章" color="amber" border=false >}}
|
|
|
|
|
{{< badge content="徽章" color="orange" border=false >}}
|
|
|
|
|
{{< badge content="徽章" color="red" border=false >}}
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
|
|
|
|
```
|
2025-08-23 15:42:23 +02:00
|
|
|
|
{{</* badge content="徽章" border=false */>}}
|
|
|
|
|
{{</* badge content="徽章" color="purple" border=false */>}}
|
|
|
|
|
{{</* badge content="徽章" color="indigo" border=false */>}}
|
|
|
|
|
{{</* badge content="徽章" color="blue" border=false */>}}
|
|
|
|
|
{{</* badge content="徽章" color="green" border=false */>}}
|
|
|
|
|
{{</* badge content="徽章" color="yellow" border=false */>}}
|
|
|
|
|
{{</* badge content="徽章" color="amber" border=false */>}}
|
|
|
|
|
{{</* badge content="徽章" color="orange" border=false */>}}
|
|
|
|
|
{{</* badge content="徽章" color="red" border=false */>}}
|
2024-12-31 00:34:20 +00:00
|
|
|
|
```
|
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
#### 变体
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
{{< badge content="徽章" icon="sparkles" >}}
|
|
|
|
|
{{< badge content="Releases" link="https://github.com/imfing/hextra/releases" icon="github" >}}
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
{{</* badge content="徽章" icon="sparkles" */>}}
|
|
|
|
|
{{</* badge content="Releases" link="https://github.com/imfing/hextra/releases" icon="github" */>}}
|
|
|
|
|
```
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
### 选项
|
2025-08-17 19:42:59 +02:00
|
|
|
|
|
2025-08-23 15:42:23 +02:00
|
|
|
|
| 姓名 | 描述 |
|
|
|
|
|
|-----------|----------------------------------------------------------------------------------------------------|
|
|
|
|
|
| `content` | 徽章的文字。 |
|
|
|
|
|
| `link` | 徽章的链接。 |
|
|
|
|
|
| `icon` | 徽章的图标。 |
|
|
|
|
|
| `color` | 徽章的颜色。 <br/> `gray` (默认), `purple`, `indigo`, `blue`, `green`, `yellow`, `amber`, `orange`, `red`. |
|
|
|
|
|
| `class` | 徽章的等级。 |
|
|
|
|
|
| `border` | 添加或删除边框 (默认:true). |
|
2025-08-17 19:42:59 +02:00
|
|
|
|
|
2024-12-31 00:34:20 +00:00
|
|
|
|
## YouTube
|
|
|
|
|
|
2025-08-14 23:49:06 +08:00
|
|
|
|
嵌入YouTube视频。
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
{{</* youtube 视频ID */>}}
|
|
|
|
|
```
|
|
|
|
|
|
2025-08-14 23:49:06 +08:00
|
|
|
|
效果:
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
|
|
|
|
{{< youtube id=dQw4w9WgXcQ loading=lazy >}}
|
|
|
|
|
|
|
|
|
|
更多信息,请参阅 [Hugo 的 YouTube 短代码](https://gohugo.io/content-management/shortcodes/#youtube)。
|
|
|
|
|
|
|
|
|
|
## PDF
|
|
|
|
|
|
2025-08-14 23:49:06 +08:00
|
|
|
|
通过PDF短代码可在内容中嵌入PDF文件。
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
{{</* pdf "https://example.com/sample.pdf" */>}}
|
|
|
|
|
```
|
|
|
|
|
|
2025-08-14 23:49:06 +08:00
|
|
|
|
也可将PDF文件置于项目目录中并使用相对路径。
|
2024-12-31 00:34:20 +00:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
{{</* pdf "path/to/file.pdf" */>}}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
示例:
|
|
|
|
|
|
|
|
|
|
{{< pdf "https://upload.wikimedia.org/wikipedia/commons/1/13/Example.pdf" >}}
|