If default image is empty print default-image.jpg <--+ How can I do this in CS?

I am using dynamic content to display images and descriptions in a blog carousel. How could I make it so that in case the author of a post doesn’t post an image, another image is displayed by default?

Something like if (image-entry === ’ ') {
image-entry = ‘default-image.jpg’;
} else { } or something like that, but in cornerstone haha

I leave an image so you can see how my posts look like without images :’)

Hello Ignacio,

Thanks for writing in!

You will have to insert two Image elements like this:

Screenshot 2023-02-27 at 9.33.38 AM

One element is your default image and the other one displays the featured image by utilizing the {{dc:post:featured_image_id}} dynamic content. In each Image element, you will apply a condition like these:

Featured Image:

Image Default:

The result would something be like this as well:

Since “Hello World” does not have a featured image, it displays the Image Default element which in my example, I chose to use an icon image as the default image.

Hope this makes sense.

1 Like

Got it, thank you very much!

Hi Ignacio,

Glad that we are able to help you.

Thanks

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