From a454455d781660521879f94e5a5734558d363375 Mon Sep 17 00:00:00 2001 From: chadcarlson Date: Fri, 1 Sep 2023 14:01:18 -0400 Subject: [PATCH] Add two versioning shortcodes. --- .../layouts/shortcodes/version/only.html | 10 ++++++++++ .../layouts/shortcodes/version/specific.html | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 themes/psh-docs/layouts/shortcodes/version/only.html create mode 100644 themes/psh-docs/layouts/shortcodes/version/specific.html diff --git a/themes/psh-docs/layouts/shortcodes/version/only.html b/themes/psh-docs/layouts/shortcodes/version/only.html new file mode 100644 index 0000000000..d8664b639c --- /dev/null +++ b/themes/psh-docs/layouts/shortcodes/version/only.html @@ -0,0 +1,10 @@ + + + + + + +{{- $version := .Site.Params.vendor.config.version -}} +{{- if eq $version ( int (.Get 0)) -}} + {{- .Inner | .Page.RenderString -}} +{{- end -}} diff --git a/themes/psh-docs/layouts/shortcodes/version/specific.html b/themes/psh-docs/layouts/shortcodes/version/specific.html new file mode 100644 index 0000000000..b4041f2287 --- /dev/null +++ b/themes/psh-docs/layouts/shortcodes/version/specific.html @@ -0,0 +1,18 @@ + + + + + + + + + +{{- $page := .Page -}} +{{- $version := .Site.Params.vendor.config.version -}} +{{- $splitVersionChar := "<--->" -}} +{{- range $k, $v := split .Inner $splitVersionChar -}} + {{- $current := add $k 1 -}} + {{- if eq $current $version -}} +{{- $v | $page.RenderString -}} + {{- end -}} +{{- end -}}