Skip to content

Commit

Permalink
Add doc-versions-list shortcode
Browse files Browse the repository at this point in the history
Signed-off-by: Marko Mudrinić <[email protected]>
  • Loading branch information
xmudrii committed Oct 16, 2023
1 parent b9bb81d commit 324e867
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ This page shows how to install the `kubeadm` toolbox.
For information on how to create a cluster with kubeadm once you have performed this installation process,
see the [Creating a cluster with kubeadm](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/) page.

This installation guide is for Kubernetes {{< skew currentVersion >}}. If you want to use a different
Kubernetes version, please refer to the following pages instead:

- [Installing kubeadm for Kubernetes {{< skew currentVersionAddMinor -1 "." >}}](https://v{{< skew currentVersionAddMinor -1 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
- [Installing kubeadm for Kubernetes {{< skew currentVersionAddMinor -2 "." >}}](https://v{{< skew currentVersionAddMinor -2 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
- [Installing kubeadm for Kubernetes {{< skew currentVersionAddMinor -3 "." >}}](https://v{{< skew currentVersionAddMinor -3 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
- [Installing kubeadm for Kubernetes {{< skew currentVersionAddMinor -4 "." >}}](https://v{{< skew currentVersionAddMinor -4 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
{{< doc-versions-list "installation guide" >}}

## {{% heading "prerequisites" %}}

Expand Down
3 changes: 3 additions & 0 deletions data/i18n/en/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ other = "I AM..."
[docs_label_users]
other = "Users"

[docs_page_versions]
other = "This %s is for Kubernetes %s. If you want to use a different Kubernetes version, please refer to the following pages instead:"

[docs_version_current]
other = "(this documentation)"

Expand Down
20 changes: 20 additions & 0 deletions layouts/shortcodes/doc-versions-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{ $versions := .Page.Param "versions" }}
{{ $thisPageRelUri := .Page.RelPermalink }}
{{ $thisPageTitle := .Page.Title }}
{{ $thisVersionArray := split (.Page.Param "version") "." }}
{{ $itemName := .Get 0 }}

<div class="version-list">
<p>
{{ printf (T "docs_page_versions") $itemName (delimit $thisVersionArray ".") }}
</p>
<ul>
{{ range $index, $version := $versions }}
{{ if ne .version ( delimit $thisVersionArray "." ) }}
<li>
<a href="{{ .url }}{{ $thisPageRelUri }}">{{ $thisPageTitle }} (Kubernetes {{ .version }})</a>
</li>
{{ end }}
{{ end }}
</ul>
</div>

0 comments on commit 324e867

Please sign in to comment.