Debian Codegraph @

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

raw
1 ---
2 title: Get
3 description: Returns the value of the given argument.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: any
9 signatures: [SHORTCODE.Get ARG]
10 ---
11
12 Specify the argument by position or by name. When calling a shortcode within Markdown, use either positional or named argument, but not both.
13
14 > [!NOTE]
15 > Some shortcodes support positional arguments, some support named arguments, and others support both. Refer to the shortcode's documentation for usage details.
16
17 ## Positional arguments
18
19 This shortcode call uses positional arguments:
20
21 ```md {file="content/about.md"}
22 {{</* myshortcode "Hello" "world" */>}}
23 ```
24
25 To retrieve arguments by position:
26
27 ```go-html-template {file="layouts/_shortcodes/myshortcode.html"}
28 {{ printf "%s %s." (.Get 0) (.Get 1) }} → Hello world.
29 ```
30
31 ## Named arguments
32
33 This shortcode call uses named arguments:
34
35 ```md {file="content/about.md"}
36 {{</* myshortcode greeting="Hello" firstName="world" */>}}
37 ```
38
39 To retrieve arguments by name:
40
41 ```go-html-template {file="layouts/_shortcodes/myshortcode.html"}
42 {{ printf "%s %s." (.Get "greeting") (.Get "firstName") }} → Hello world.
43 ```
44
45 > [!NOTE]
46 > Argument names are case-sensitive.