diff options
Diffstat (limited to 'content/en/functions/get.md')
-rw-r--r-- | content/en/functions/get.md | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/content/en/functions/get.md b/content/en/functions/get.md index c5b75c7fd..27f348807 100644 --- a/content/en/functions/get.md +++ b/content/en/functions/get.md @@ -18,12 +18,11 @@ aliases: [] needsexample: true --- - `.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. -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: +When accessing named or positional parameters that do not exist, `.Get` returns an empty string instead of interrupting the build. This allows you to chain `.Get` with `if`, `with`, `default` or `cond` to check for parameter existence. For example: -``` +```go-html-template {{ $quality := default "100" (.Get 1) }} ``` |