#Conditional image

1 messages · Page 1 of 1 (latest)

round quiver
#

Hey, I'm trying to create a layout that will show an image if an image is available, and won't show the entire image block if there is no available image. Currently, the only way I found to achieve this in Novu is to create two separated layouts: one with the image and one without the image.

As far as I understand, you guys use Liquid JS for templating, and Liquid JS supports if-else conditions. So, can you guys investigate the possibility of making if-else available inside the template editor so we can conditionally display a message without having to create two separated workflows?

If that is already supported, can you please update the documentation or point me to the right direction?

icy knot
#

@round quiver

We currently don't support payload variables in layouts

#

Can you please share how this image is used in the layout editor?

round quiver
#

Our product is a multi tenant application for communities. Each tenant has an image/icon. We want each tenant/community to receive the notification emails with their own image in the layout.

We already sent the logoUrl to the Novu Context but some tenants/communities, might not have an image/icon. In those cases, we want to remove the image block entirely, not rendering it.

icy knot
#

@round quiver

we support liquidjs if else helper,

{% if context.tenant.data.imageUrl %}

// show image block

{% endif %}