If with get for string? (In shortcode)

Quick template help needed for a shortcode. I cannot figure out how to get a variable passed to a shortcode and use that in an if statement.

{{ if ( .Get "side") eq "left"}}
  template left
{{else}}
  template right
{{end}}

Every variation I see documented on how to use it throws me a different error. Clearly I’missing something basic here.

{{ if  eq (.Get "side") "left" }}
  template left
{{ else }}
  template right
{{ end }}
1 Like

Try This,

{{ if eq ( .Get “side”) “left”}}
template left
{{else}}
template right
{{end}}

1 Like

Thank you very much. I read that page but had been going around in circles so much didn’t grasp that I had the order incorrect. Looking at what you wrote and that doc now it’s quite obvious.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.