Debian Codegraph @

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

raw
1 ---
2 title: Params
3 description: Returns a collection of the shortcode arguments.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: any
9 signatures: [SHORTCODE.Params]
10 ---
11
12 When you call a shortcode using positional arguments, the `Params` method returns a slice.
13
14 ```md {file="content/about.md"}
15 {{</* myshortcode "Hello" "world" */>}}
16 ```
17
18 ```go-html-template {file="layouts/_shortcodes/myshortcode.html"}
19 {{ index .Params 0 }} → Hello
20 {{ index .Params 1 }} → world
21 ```
22
23 When you call a shortcode using named arguments, the `Params` method returns a map.
24
25 ```md {file="content/about.md"}
26 {{</* myshortcode greeting="Hello" name="world" */>}}
27 ```
28
29 ```go-html-template {file="layouts/_shortcodes/myshortcode.html"}
30 {{ .Params.greeting }} → Hello
31 {{ .Params.name }} → world
32 ```