Sorry, it won’t work w/r/t redefining the variable, but you can use the .Get
directly, at least that’s the way it’s currently being represented in the docs…
So…
{{if .IsNamedParams}}
<img src="images/{{.Get "name"}}"/>
{{else}}
<img src="images/{{.Get 0}}"/>
{{end}}