Back to Hugo

Params

docs/content/en/methods/shortcode/Params.md

0.161.1615 B
Original Source

When you call a shortcode using positional arguments, the Params method returns a slice.

text
{{</* myshortcode "Hello" "world" */>}}
go-html-template
{{ index .Params 0 }} → Hello
{{ index .Params 1 }} → world

When you call a shortcode using named arguments, the Params method returns a map.

text
{{</* myshortcode greeting="Hello" name="world" */>}}
go-html-template
{{ .Params.greeting }} → Hello
{{ .Params.name }} → world