From e38d549721c3a2de83e8e21ab7a3b188e7f12cf9 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Thu, 17 Jun 2021 19:44:09 +0100 Subject: [PATCH 1/2] Add shortcode for hyperlinking to examples --- layouts/shortcodes/example.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 layouts/shortcodes/example.html diff --git a/layouts/shortcodes/example.html b/layouts/shortcodes/example.html new file mode 100644 index 0000000000..0d6eb7a370 --- /dev/null +++ b/layouts/shortcodes/example.html @@ -0,0 +1,14 @@ +{{ $file := .Get "file" }} +{{ $codelang := .Get "language" | default (path.Ext $file | strings.TrimPrefix ".") }} +{{ $fileDir := path.Split $file }} +{{ $bundlePath := path.Join .Page.File.Dir $fileDir.Dir }} +{{ $filename := printf "/content/%s/examples/%s" .Page.Lang $file | safeURL }} +{{ $ghlink := printf "https://%s/%s%s" site.Params.githubwebsiteraw (default "main" (site.Params.github_branch)) $filename | safeURL }} + + +{{- if gt (len .Inner) 0 -}} + {{- .Inner -}} +{{- else -}} + {{- $file -}} +{{- end -}} + From b3aef35da75d595f81600f48123719b2862ac936 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Thu, 17 Jun 2021 19:44:20 +0100 Subject: [PATCH 2/2] Use shortcode for PodSecurityPolicy examples --- content/en/docs/concepts/security/pod-security-standards.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/en/docs/concepts/security/pod-security-standards.md b/content/en/docs/concepts/security/pod-security-standards.md index 32635d6747..5a69cc8e64 100644 --- a/content/en/docs/concepts/security/pod-security-standards.md +++ b/content/en/docs/concepts/security/pod-security-standards.md @@ -283,9 +283,9 @@ of individual policies are not defined here. [**PodSecurityPolicy**](/docs/concepts/policy/pod-security-policy/) -- [Privileged](https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/policy/privileged-psp.yaml) -- [Baseline](https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/policy/baseline-psp.yaml) -- [Restricted](https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/policy/restricted-psp.yaml) +- {{< example file="policy/privileged-psp.yaml" >}}Privileged{{< /example >}} +- {{< example file="policy/baseline-psp.yaml" >}}Baseline{{< /example >}} +- {{< example file="policy/restricted-psp.yaml" >}}Restricted{{< /example >}} ## FAQ