Abbreviations

To create abbreviations with titles.

Syntax

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

Parameters

text

PositionNameTypeRequiredDefaultSinceExample
#0textstring---

The rendered text, case-sensitive, which also used as the key of data files.

title

PositionNameTypeRequiredDefaultSinceExample
#1titlestring----

Define the title in-place instead of reading it from data files.

Data Files

The data files should be placed under the data/abbreviations folder, and naming it in site language code, such as data/abbreviations/en.toml for English site.

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

The Hugo and HugoMods on above example data file are the text (key) of the shortcode.

Examples

Let’s say the data file as same as the above example data file.

Abbreviations Using Site Data

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

Abbreviations With Specified Title

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

Abbreviations With Non-existent or Invalid Keys

Source
1The {{< abbr "hugo" >}} and {{< abbr "foobar" >}} will still be rendered, but without titles and will got the following similar warning messages.
Result
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"