---
description: "Positional or named parameters"
---
https://gohugo.io/templates/shortcode-templates/
1) {{< get-parameters-generic-01 >}}
2) {{< get-parameters-generic-01 1 2 3 4 5 >}}
3) {{< get-parameters-generic-01 "1" "2" "3" >}}
4) {{< get-parameters-generic-01 arg1="1" arg5="foo" >}}
5) {{< get-parameters-generic-01 arg2="2" arg4="4" arg1="1" arg5="5" arg3="3" >}}
6) {{< get-parameters-generic-01 arg4="" arg1="42" >}}
{{/* arg4 => default value, not emtpy */}}
7)
{{< get-parameters-generic-01
arg1="42"
arg5="bar"
>}}
### not cool:
{{< get-parameters-generic-01 arg1=42 arg5="foo" >}}
see [get-parameters-test-02](../get-parameters-test-02)
So **always** quote using **`"`**
https://gohugo.io/templates/shortcode-templates/
1)
(1:)
(2:default2)
(3:default3)
(4:default4)
(5:)
2)
(1:1)
(2:2)
(3:3)
(4:4)
(5:5)
3)
(1:1)
(2:2)
(3:3)
(4:default4)
(5:)
4)
(1:1)
(2:default2)
(3:default3)
(4:default4)
(5:foo)
5)
(1:1)
(2:2)
(3:3)
(4:4)
(5:5)
6)
(1:42)
(2:default2)
(3:default3)
(4:default4)
(5:)
{{/* arg4 => default value, not emtpy */}}
7)
(1:42)
(2:default2)
(3:default3)
(4:default4)
(5:bar)
(1:foo)
(2:default2)
(3:default3)
(4:default4)
(5:)
see get-parameters-test-02
So always quote using "
{{- $.Scratch.Set "theArgument1" "" }}
{{- $.Scratch.Set "theArgument2" "default2" }}
{{- $.Scratch.Set "theArgument3" "default3" }}
{{- $.Scratch.Set "theArgument4" "default4" }}
{{- $.Scratch.Set "theArgument5" "" }}
{{- if .IsNamedParams }}
{{- $.Scratch.Set "theArgument1" (.Get "arg1" | default ($.Scratch.Get "theArgument1" ) )}}
{{- $.Scratch.Set "theArgument2" (.Get "arg2" | default ($.Scratch.Get "theArgument2" ) )}}
{{- $.Scratch.Set "theArgument3" (.Get "arg3" | default ($.Scratch.Get "theArgument3" ) )}}
{{- $.Scratch.Set "theArgument4" (.Get "arg4" | default ($.Scratch.Get "theArgument4" ) )}}
{{- $.Scratch.Set "theArgument5" (.Get "arg5" | default ($.Scratch.Get "theArgument5" ) )}}
{{- else }}
{{- $myPos := 0}} {{ if gt (len .Params) $myPos }} {{$.Scratch.Set "theArgument1" (.Get $myPos) }} {{end}}
{{- $myPos := 1}} {{ if gt (len .Params) $myPos }} {{$.Scratch.Set "theArgument2" (.Get $myPos) }} {{end}}
{{- $myPos := 2}} {{ if gt (len .Params) $myPos }} {{$.Scratch.Set "theArgument3" (.Get $myPos) }} {{end}}
{{- $myPos := 3}} {{ if gt (len .Params) $myPos }} {{$.Scratch.Set "theArgument4" (.Get $myPos) }} {{end}}
{{- $myPos := 4}} {{ if gt (len .Params) $myPos }} {{$.Scratch.Set "theArgument5" (.Get $myPos) }} {{end}}
{{- end }}
(1:{{- $.Scratch.Get "theArgument1" }})
(2:{{- $.Scratch.Get "theArgument2" }})
(3:{{- $.Scratch.Get "theArgument3" }})
(4:{{- $.Scratch.Get "theArgument4" }})
(5:{{- $.Scratch.Get "theArgument5" }})