diff --git a/layouts/shortcodes/feature-state.html b/layouts/shortcodes/feature-state.html
index 47abccdc51..739fc3a14b 100644
--- a/layouts/shortcodes/feature-state.html
+++ b/layouts/shortcodes/feature-state.html
@@ -1,55 +1,48 @@
{{ $valid_states := "alpha, beta, deprecated, stable" }}
{{ $state := .Get "state" }}
-{{ $for_k8s_version := .Get "for_k8s_version" | default (.Page.Param "version")}}
+{{ $for_k8s_version := .Get "for_k8s_version" | default (.Page.Param "version") }}
{{ $is_valid := strings.Contains $valid_states $state }}
{{ $feature_gate_name := .Get "feature_gate_name" }}
-
{{ if not $feature_gate_name }}
{{ if not $is_valid }}
{{ errorf "%q is not a valid feature-state, use one of %q" $state $valid_states }}
{{ else }}
-
- {{ T "feature_state" }} {{T "feature_state_kubernetes_label" }} {{ $for_k8s_version }} [{{ $state }}]
-
+
+ {{ T "feature_state" }}
+ {{ T "feature_state_kubernetes_label" }} {{ $for_k8s_version }} [{{ $state }}]
+
{{ end }}
-
-{{- else -}}
-
-
-
+{{ else }}
+
+
{{- $featureGateDescriptionFilesPath := "/docs/reference/command-line-tools-reference/feature-gates" -}}
-
-
+
{{- with index (where .Site.Sites "Language.Lang" "eq" "en") 0 -}}
{{- with .GetPage $featureGateDescriptionFilesPath -}}
-
{{- $sortedFeatureGates := sort (.Resources.ByType "page") -}}
{{- $featureGateFound := false -}}
-
{{- range $featureGateFile := $sortedFeatureGates -}}
{{- $featureGateNameFromFile := $featureGateFile.Params.Title -}}
{{- if eq $featureGateNameFromFile $feature_gate_name -}}
-
{{- $currentStage := index $featureGateFile.Params.stages (sub (len $featureGateFile.Params.stages) 1) -}}
{{- with $currentStage -}}
-
-
-
- {{ T "feature_state" }} {{T "feature_state_kubernetes_label" }} v{{ .fromVersion }} [{{ .stage }}]
-
+
+
+ {{ T "feature_state" }}
+ {{ T "feature_state_kubernetes_label" }} v{{ .fromVersion }} [{{ .stage }}]
+
{{- $featureGateFound = true -}}
{{- end -}}
{{- end -}}
{{- end -}}
-
{{- if not $featureGateFound -}}
- {{- errorf "Invalid feature gate: '%s' is not recognized or lacks a matching description file in '%s'" $feature_gate_name (print "en" $featureGateDescriptionFilesPath) -}}
+ {{- errorf "Invalid feature gate: '%s' is not recognized or lacks a matching description file in '%s'" $feature_gate_name (print "en" $featureGateDescriptionFilesPath) -}}
{{- end -}}
{{- end -}}