github.com/rabbouni145/gg@v0.47.1/docs/content/en/functions/get.md (about) 1 --- 2 title: .Get 3 description: Accesses positional and ordered parameters in shortcode declaration. 4 godocref: 5 date: 2017-02-01 6 publishdate: 2017-02-01 7 lastmod: 2017-02-01 8 categories: [functions] 9 menu: 10 docs: 11 parent: "functions" 12 keywords: [shortcodes] 13 signature: [".Get INDEX", ".Get KEY"] 14 workson: [] 15 hugoversion: 16 relatedfuncs: [] 17 deprecated: false 18 aliases: [] 19 needsexample: true 20 --- 21 22 23 `.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. 24 25 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: 26 27 ``` 28 {{ $quality := default "100" (.Get 1) }} 29 ``` 30 31 [sc]: /templates/shortcode-templates/ 32 33 34 35