Streaming live at 10am (PST)

Help With CMS Image Conditional

#1

I have a CMS Collection with an optional image field. What I would like to do is show a default image if there is no value in the CMS field for image. Is that possible? I am using a DIV with a background image if that matters.

#2

Yes.

image

Add image (or div1 with background) for “is not” set. Like this, you get “placeholder”.
And regular image (or div2 with background) to show only if “is set”.

By background image its more tricky (No way to create Conditional CSS properties (yet)).
So use “is not” as regular image element (If there is nothing inside this bg-image div - use two divs & two backgrounds).

#3

Works perfect. Thanks so much!

1 Like