mirror of
https://github.com/gohugoio/hugo.git
synced 2026-09-03 04:02:38 +00:00
6f0ba95935
These references haven't been visible for years. Related to: - https://github.com/gohugoio/gohugoioTheme/issues/24 - https://github.com/gohugoio/gohugoioTheme/pull/216
1.1 KiB
1.1 KiB
title, description, date, publishdate, lastmod, categories, menu, keywords, signature, workson, hugoversion, relatedfuncs, deprecated, aliases, needsexample
| title | description | date | publishdate | lastmod | categories | menu | keywords | signature | workson | hugoversion | relatedfuncs | deprecated | aliases | needsexample | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| .Get | Accesses positional and ordered parameters in shortcode declaration. | 2017-02-01 | 2017-02-01 | 2017-02-01 |
|
|
|
|
false | true |
.Get is specifically used when creating your own shortcode template, to access the positional and named 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:
{{ $quality := default "100" (.Get 1) }}