I have a rendering in a placeholder that has an image field. When in edit mode in Experience Editor without an image it shows a default image from Sitecore. This default image allows the user to set that image field or manipulate it. However, the image is optional and when working with the Experience Editor it "throws off" the layout and the only way to see the more accurate rendering is to save and go into preview mode. I'd like to avoid having the user go through that every time they need to make an edit just to line things up better.

So is there a way to not display the default image in Experience Editor but still allow a user to add an image into the rendering?

I believe that I could put a placeholder in the rendering and allow the user to add an image to the placeholder. But that brings up a bunch of issues (dynamic placeholders) so I don't want to do it that way.

The rendering on the left won't have an image so I'd like to hide the image when in editing mode, but still have the option to add an image.

  • You could render an Edit Frame when there is no image to allow user select image, and if image is already selected, use image field as you do now.
    – Marek Musielak
    Commented Jun 30, 2017 at 19:11
  • Any good tutorial on Edit Frame's in Sitecore 8?
    – Kevin
    Commented Jun 30, 2017 at 19:16
  • If you're using Sitecore MVC, you don't even need Edit Frame - just use custom button like explained here sitecore.stackexchange.com/questions/3301/… . If you're using WebForms - any Edit Frame tutorial (even for Sitecore 6) should work.
    – Marek Musielak
    Commented Jun 30, 2017 at 19:24

2 Answers 2


I get what you're saying, but you're not walking on Sitecore's path of least resistance here.

While there are (several) ways to achieve this, I don't particularly like either of them for a variety of reasons - one of them being Edit Frames, as mentioned by Marek. Essentially Edit Frames will allow you to have a different handling of the image field. It will involve user clicks and a bit of a clunky interface - also a bit of setup and complexity.

My personal preference would be this:

Set up an additional component, make it compatible with your current one. One would be "Blurp without image", the other "Blurp with image". They will act the same, run on the same code, use the same data source template. Only difference will be, one of them will output the image tag for the image field - one will not.

This also saves you, outputting HTML for the image when none is selected - something you likely already have to work your way around in some way.

Setting up components like this, is a matter of defining "Compatible Renderings" on the Component Definition Item. Like this.

enter image description here

Additionally; when you have compatible components like this, your editors can easily switch between one or the other as required. It becomes a button on the rendering context bar.

Like this:

enter image description here

Lastly, don't forget to define your alternate components as placeholder settings - Sitecore will only enable the "Replace Component" button if there are more to choose from. In my vanilla solution, this is where it is set:

enter image description here

For you, likely these settings will look different of course.

  • I like that second suggestion. How does one make components compatible?
    – Kevin
    Commented Jun 30, 2017 at 19:26
  • Updated answer. See also caveat with placeholder settings. sitecore.stackexchange.com/questions/1573/…
    – Mark Cassidy
    Commented Jun 30, 2017 at 19:33
  • Nice. I think the caveats don't affect me. So do I use rendering parameters in the code to determine which rendering is being used?
    – Kevin
    Commented Jun 30, 2017 at 19:37
  • No, on placeholder settings. Updated answer to demonstrate :-)
    – Mark Cassidy
    Commented Jun 30, 2017 at 19:40
  • I have my placeholder settings/allowed controls setup. How do I tell whether or not to display the image? I.e. if("???blurb with image???") { Html.Sitecore().Field("Image Field") } I could use rendering parameters or something else?
    – Kevin
    Commented Jun 30, 2017 at 19:42

Based on your question my understanding is that the size of the default image is causing you the layout to break correct?

In cases like this you can fix it through css specific for experience editor mode to have a default size for the images when not selected. I personally prefer this option

Or you could go directly to the placeholder image and create your own and replace with it. The path to the default one is: "/sitecore/shell/Themes/Standard/Images/WebEdit/default_image.png"

This second option carries a caveat which is, if you upgrade Sitecore your image will be overridden so you might consider adding to source control or taking other routes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.