縮寫表

創建帶有標題的縮寫表。

語法

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"