Skip to content

Commit a840305

Browse files
authored
Merge pull request #46324 from sftim/20240511_drop_param_shortcode
Warn on new use of param shortcode
2 parents 3d363df + add8b37 commit a840305

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

layouts/shortcodes/param.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
{{- .Page.Param (.Get 0) -}}
1+
{{- $name := (.Get 0) -}}
2+
{{- with $name -}}
3+
{{- with ($.Page.Param .) }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}}
4+
{{- else }}{{ errorf "Missing param key: %s" $.Position }}{{ end -}}
5+
{{- with $.Page.File.Filename -}}
6+
{{- $warningText := slice
7+
"Deprecated param shortcode detected."
8+
"The Kubernetes website does not / should not use param shortcodes."
9+
( printf "Check %q" ( replaceRE "^/src/" "" . ) ) -}}
10+
{{- if and (eq $.Site.LanguagePrefix "") (ne $name "version" ) -}}
11+
{{- warnf (delimit $warningText " " ) -}}
12+
{{- end -}}
13+
{{- end -}}

0 commit comments

Comments
 (0)