tpl: Add "param" shortcode

Fixes #4010
This commit is contained in:
Bjørn Erik Pedersen
2018-11-27 16:53:11 +01:00
parent aded0f25fd
commit f37c5a2567
3 changed files with 27 additions and 0 deletions

View File

@@ -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 -}}

View File

@@ -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 -}}