Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-11-27 18:53:11 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-11-27 19:34:03 +0300
commitf37c5a25676db89c0e804ccaac69bb392758192b (patch)
tree951a3259bd6f24243de5ba83dcfec0e32b61c241 /tpl
parentaded0f25fd23a78804b10e127aebe0e4b6fed2ac (diff)
tpl: Add "param" shortcode
Fixes #4010
Diffstat (limited to 'tpl')
-rw-r--r--tpl/tplimpl/embedded/templates.autogen.go4
-rw-r--r--tpl/tplimpl/embedded/templates/shortcodes/param.html4
2 files changed, 8 insertions, 0 deletions
diff --git a/tpl/tplimpl/embedded/templates.autogen.go b/tpl/tplimpl/embedded/templates.autogen.go
index defc0f313..76a15e452 100644
--- a/tpl/tplimpl/embedded/templates.autogen.go
+++ b/tpl/tplimpl/embedded/templates.autogen.go
@@ -398,6 +398,10 @@ if (!doNotTrack) {
</style>
{{ end }}
{{ end }}`},
+ {`shortcodes/param.html`, `{{- $name := (.Get 0) -}}
+{{- with $name -}}
+{{- with ($.Page.Param .) }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}}
+{{- else }}{{ errorf "Missing param key: %s" $.Position }}{{ end -}}`},
{`shortcodes/ref.html`, `{{ ref . .Params }}`},
{`shortcodes/relref.html`, `{{ relref . .Params }}`},
{`shortcodes/twitter.html`, `{{- $pc := .Page.Site.Config.Privacy.Twitter -}}
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/param.html b/tpl/tplimpl/embedded/templates/shortcodes/param.html
new file mode 100644
index 000000000..74aa3ee7b
--- /dev/null
+++ b/tpl/tplimpl/embedded/templates/shortcodes/param.html
@@ -0,0 +1,4 @@
+{{- $name := (.Get 0) -}}
+{{- with $name -}}
+{{- with ($.Page.Param .) }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}}
+{{- else }}{{ errorf "Missing param key: %s" $.Position }}{{ end -}} \ No newline at end of file