Since
The since shortcode renders a small badge with the release that introduced a feature, for example “since 2.17.0”. Use it on documentation and changelog pages. The badge is plain text unless you configure a release address; then it is a link to the release.
Syntax #
{{< since "2.17.0" >}}
{{< since version="2.17.0" >}}
{{< since >}}Without an argument, the shortcode uses the page’s since front matter value. Use positional or named arguments; Hugo stops the build if one call mixes both.
Arguments #
The argument takes precedence over the front matter value. If neither exists, nothing renders and the build log shows a warning.
Configuration #
The release address and the link target are site parameters under [params.ananke.shortcodes.since]. Both are optional.
# config/_default/params.toml
[ananke.shortcodes.since]
repo_url = "https://github.com/gohugo-ananke/ananke/releases/tag/v%s"With this configuration, {{< since "2.17.0" >}} links to https://github.com/gohugo-ananke/ananke/releases/tag/v2.17.0.
Output #
Without repo_url, the shortcode renders a <span> in a badge style. With repo_url, it renders an <a> element in the same style. The default target is _blank; when the target is not _self or false, the link also has rel="noopener".
The text is the since translation string followed by the version.
Translation strings #
| Key | Default English value | Used for |
|---|---|---|
since | since | The word before the version. |
To change the text, override the string in your project’s i18n/<language>.toml. See Overriding theme interface strings.
Build messages #
| Message | Cause |
|---|---|
the 'since' shortcode in "<path>" needs a version argument or a 'since' front matter value | No argument and no since front matter. Nothing renders. |
Accessibility #
The badge text names the release, so it is meaningful without its style. As a link, it opens in a new tab by default; set target = false to keep readers in the same window.
Related pages #
- Edit page: links to the GitHub editor. It also reads its settings from
params.ananke.shortcodes. - Configuration reference: all shortcode parameters.