diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-01-26 08:22:42 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-01-26 08:22:42 +0100 |
commit | 3758456b31695dd59ebe5eb35b19c1b054287a48 (patch) | |
tree | a6391bec1ee0247632cb5bf526175bb1defba804 /docs/layouts | |
parent | d0d2c6795e0870bf96d167700a475737a17ea005 (diff) | |
parent | 7125ad401ad043e46262afc7eca8dceb6d54bb9e (diff) |
Merge commit '7125ad401ad043e46262afc7eca8dceb6d54bb9e'
Diffstat (limited to 'docs/layouts')
-rw-r--r-- | docs/layouts/shortcodes/new-in.html | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/docs/layouts/shortcodes/new-in.html b/docs/layouts/shortcodes/new-in.html deleted file mode 100644 index e22a91f3d..000000000 --- a/docs/layouts/shortcodes/new-in.html +++ /dev/null @@ -1,36 +0,0 @@ -{{- /* -Renders a "new in" button indicating the version in which a feature was added. - -When comparing the current version to the specified version, the "new in" -button will be hidden if any of the following conditions is true: - -- The major version difference exceeds the majorVersionDiffThreshold -- The minor version difference exceeds the minorVersionDiffThreshold - -@param {string} version The semantic version string, with or without a leading v. -@returns {template.HTML} - -@example {{< new-in 0.100.0 >}} -*/}} - -{{- /* Set defaults. */}} -{{- $majorVersionDiffThreshold := 0 }} -{{- $minorVersionDiffThreshold := 30 }} -{{- $displayExpirationWarning := true }} - -{{- /* Render. */}} -{{- with $version := .Get 0 | strings.TrimPrefix "v" }} - {{- $majorVersionDiff := sub (index (split hugo.Version ".") 0 | int) (index (split $version ".") 0 | int) }} - {{- $minorVersionDiff := sub (index (split hugo.Version ".") 1 | int) (index (split $version ".") 1 | int) }} - {{- if or (gt $majorVersionDiff $majorVersionDiffThreshold) (gt $minorVersionDiff $minorVersionDiffThreshold) }} - {{- if $displayExpirationWarning }} - {{- warnf "This call to the %q shortcode should be removed: %s. The button is now hidden because the specified version (%s) is older than the display threshold." $.Name $.Position $version }} - {{- end }} - {{- else }} - <button class="bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 mr2 px-4 border border-gray-400 rounded shadow"> - <a href="{{ printf "https://github.com/gohugoio/hugo/releases/tag/v%s" $version }}">New in v{{ $version }}</a> - </button> - {{- end }} -{{- else }} - {{- errorf "The %q shortcode requires a positional parameter (version). See %s" .Name .Position }} -{{- end -}} |