缩写表

创建带有标题的缩写表。

语法

1{{< abbr [text] [title] >}}

参数

text

索引名称类型必填默认值版本
#0textstring--

显示的文本,大小写敏感,其同时被用作数据文件的

title

索引名称类型必填默认值版本
#1titlestring---

就地定义标题,而不是从数据文件读取。

数据文件

数据文件应存放于 data/abbreviations 目录,并以站点语言代码进行命名,比如 data/abbreviations/en.toml 对应英文站点。

data/abbreviations/en.toml
1Hugo = "The world's fastest framework for building static websites"
2HugoMods = "Hugo Modules"

上述示例数据文件中,HugoHugoMods 就是短代码的 text(键)。

示例

以上述示例数据文件作为例子。

使用数据文件

1{{< abbr "HugoMods" >}} is a collection of third party modules for {{< abbr "Hugo" >}}.
HugoMods is a collection of third party modules for Hugo.

就地定义标题

1{{< abbr "HugoMods" "Third party Hugo modules" >}} is a collection of third party modules for {{< abbr "Hugo" >}}.
HugoMods is a collection of third party modules for Hugo.

不存在或者无效的缩写

1The {{< abbr "hugo" >}} and {{< abbr "foobar" >}} will still be rendered, but without titles and will got the following similar warning messages.
The hugo and foobar will still be rendered, but without titles and will got the following similar warning messages.
1WARN  [abbr] missing title for "hugo"
2WARN  [abbr] missing title for "foobar"