diff --git a/content/en/docs/tasks/run-application/deployment.yaml b/content/en/artifacts/application/deployment.yaml similarity index 100% rename from content/en/docs/tasks/run-application/deployment.yaml rename to content/en/artifacts/application/deployment.yaml diff --git a/content/en/docs/tasks/run-application/run-stateless-application-deployment.md b/content/en/docs/tasks/run-application/run-stateless-application-deployment.md index 61b2f08f3d..27b9aafb89 100644 --- a/content/en/docs/tasks/run-application/run-stateless-application-deployment.md +++ b/content/en/docs/tasks/run-application/run-stateless-application-deployment.md @@ -36,12 +36,12 @@ You can run an application by creating a Kubernetes Deployment object, and you can describe a Deployment in a YAML file. For example, this YAML file describes a Deployment that runs the nginx:1.7.9 Docker image: -{{< code file="deployment.yaml" >}} +{{< codenew file="application/deployment.yaml" >}} 1. Create a Deployment based on the YAML file: - kubectl apply -f https://k8s.io/docs/tasks/run-application/deployment.yaml + kubectl apply -f https://k8s.io/docs/artifacts/application/deployment.yaml 1. Display information about the Deployment: diff --git a/layouts/shortcodes/codenew.html b/layouts/shortcodes/codenew.html new file mode 100644 index 0000000000..2224065aed --- /dev/null +++ b/layouts/shortcodes/codenew.html @@ -0,0 +1,38 @@ +{{ $p := .Page }} +{{ $file := .Get "file" }} +{{ $codelang := .Get "language" | default (path.Ext $file | strings.TrimPrefix ".") }} +{{ $fileDir := path.Split $file }} +{{ $bundlePath := path.Join .Page.Dir $fileDir.Dir }} +{{ $filename := printf "/content/%s/artifacts/%s" .Page.Lang $file | safeURL }} +{{ $ghlink := printf "https://%s/blob/master%s" .Page.Site.Params.githubWebsiteRepo $filename | safeURL }} +{{/* First assume this is a bundle and the file is inside it. */}} +{{ $resource := $p.Resources.GetMatch (printf "%s*" $file ) }} +{{ with $resource }} +{{ $.Scratch.Set "content" .Content }} +{{ else }} +{{/* Read the file relative to the content root. */}} +{{ $resource := readFile $filename}} +{{ with $resource }}{{ $.Scratch.Set "content" . }}{{ end }} +{{ end }} +{{ if not ($.Scratch.Get "content") }} +{{ errorf "[%s] %q not found in %q" $p.Site.Language.Lang $fileDir.File $bundlePath }} +{{ end }} +{{ with $.Scratch.Get "content" }} +
+ {{ with $ghlink }}{{ end }}
+ {{ $file }}
+ {{ if $ghlink }}{{ end }}
+ |
+
|---|
| {{ highlight . $codelang "" }} | +