How to check if variable exists for src and href otherwise use default value?

34 Views Asked by At

I have an image within a tag in a handlebars email. Both src and href values are optional variables.

I want to use the url if it exists otherwise default_url AND use image_url if it exists otherwise default_image_url

What is the best way to write this in valid handlebars notation?

<a href={{url ? url : 'default_url'}}>
  <img src={{image_url ? image_url : 'default_image_url'}}/>
</a>
0

There are 0 best solutions below