diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-11-27 16:53:11 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-11-27 17:34:03 +0100 |
commit | f37c5a25676db89c0e804ccaac69bb392758192b (patch) | |
tree | 951a3259bd6f24243de5ba83dcfec0e32b61c241 /tpl | |
parent | aded0f25fd23a78804b10e127aebe0e4b6fed2ac (diff) |
tpl: Add "param" shortcode
Fixes #4010
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/tplimpl/embedded/templates.autogen.go | 4 | ||||
-rw-r--r-- | tpl/tplimpl/embedded/templates/shortcodes/param.html | 4 |
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 |