Skip to content

Commit 81a3f54

Browse files
authored
Merge pull request #23520 from sftim/20200828_revise_available_docs_versions_list
Revise “Supported Versions of the Kubernetes Documentation”
2 parents e87e065 + 2e55488 commit 81a3f54

File tree

4 files changed

+53
-22
lines changed

4 files changed

+53
-22
lines changed
Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,12 @@
11
---
2-
title: Supported Versions of the Kubernetes Documentation
3-
content_type: concept
2+
title: Available Documentation Versions
3+
content_type: custom
4+
layout: supported-versions
45
card:
56
name: about
67
weight: 10
7-
title: Supported Versions of the Documentation
8+
title: Available Documentation Versions
89
---
910

10-
<!-- overview -->
11-
1211
This website contains documentation for the current version of Kubernetes
1312
and the four previous versions of Kubernetes.
14-
15-
16-
17-
<!-- body -->
18-
19-
## Current version
20-
21-
The current version is
22-
[{{< param "version" >}}](/).
23-
24-
## Previous versions
25-
26-
{{< versions-other >}}
27-
28-
29-
30-

i18n/en.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ other = "I AM..."
5454
[docs_label_users]
5555
other = "Users"
5656

57+
[docs_version_current]
58+
other = "(this documentation)"
59+
60+
[docs_version_latest_heading]
61+
other = "Latest version"
62+
63+
[docs_version_other_heading]
64+
other = "Older versions"
65+
5766
[examples_heading]
5867
other = "Examples"
5968

layouts/docs/supported-versions.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{{ define "main" }}
2+
<div class="td-content">
3+
{{ partial "docs/content-page" (dict "ctx" . "page" .) }}
4+
{{ $versions := .Page.Param "versions" }}
5+
{{ $thisPageRelUri := .Page.RelPermalink }}
6+
{{ $thisVersionArray := split (.Page.Param "version") "." }}
7+
{{ $.Scratch.Set "version-class" (slice "placeholder") }}
8+
{{/* "placeholder" is also used later to check whether we opened the <ul> */}}
9+
{{ range $index, $version := $versions }}
10+
{{ $.Scratch.Set "version-class" (slice "") }}
11+
{{ $versionArray := split .version "." }}
12+
13+
{{ if eq $index 0 }}
14+
<h2 id="version-latest">{{ T "docs_version_latest_heading" }}</h2>
15+
<ul>
16+
{{ $.Scratch.Set "version-class" ($.Scratch.Get "version-class" | append "version-latest" ) }}
17+
{{ end }}
18+
{{ if eq $index 1 }}
19+
</ul>
20+
<h2 id="versions-older">{{ T "docs_version_other_heading" }}</h2>
21+
<ul>
22+
{{ end }}
23+
24+
{{ if eq .version ( delimit $thisVersionArray "." ) }}
25+
{{ $.Scratch.Set "version-class" ($.Scratch.Get "version-class" | append "version-current" ) }}
26+
{{ end }}
27+
28+
<li class="{{ delimit ( $.Scratch.Get "version-class") " " }}">
29+
<a href="{{ .url }}{{ $thisPageRelUri }}">{{ .version }}</a>
30+
{{ if eq .version ( delimit $thisVersionArray "." ) }}
31+
{{ T "docs_version_current" }}
32+
{{ end }}
33+
</li>
34+
{{ end }}
35+
{{ if ne (index ($.Scratch.Get "version-class") 0) "placeholder" }}
36+
</ul>
37+
{{ end }}
38+
39+
{{ end }}

layouts/shortcodes/versions-other.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{/* this shortcode is DEPRECATED */}}
12
{{ $versions := .Page.Param "versions" }}
23
{{ $thisVersion := .Page.Param "version" }}
34
<ul>

0 commit comments

Comments
 (0)