get.md (1132B)
1 ---
2 title: .Get
3 description: Accesses positional and ordered parameters in shortcode declaration.
4 date: 2017-02-01
5 publishdate: 2017-02-01
6 lastmod: 2017-02-01
7 categories: [functions]
8 menu:
9 docs:
10 parent: "functions"
11 keywords: [shortcodes]
12 signature: [".Get INDEX", ".Get KEY"]
13 workson: []
14 hugoversion:
15 relatedfuncs: []
16 deprecated: false
17 aliases: []
18 needsexample: true
19 ---
20
21
22 `.Get` is specifically used when creating your own [shortcode template][sc], to access the [positional and named](/templates/shortcode-templates/#positional-vs-named-parameters) parameters passed to it. When used with a numeric INDEX, it queries positional parameters (starting with 0). With a string KEY, it queries named parameters.
23
24 When accessing a named parameter that does not exist, `.Get` returns an empty string instead of interrupting the build. The same goes with positional parameters in hugo version 0.40 and after. This allows you to chain `.Get` with `if`, `with`, `default` or `cond` to check for parameter existence. For example, you may now use:
25
26 ```
27 {{ $quality := default "100" (.Get 1) }}
28 ```
29
30 [sc]: /templates/shortcode-templates/