2

I have a content search web part that returns site collections. I don't want the search to show the site icon. The box that shows the site icon

I can't hide the div because each item has a unique class. Is this possible? I can't find any answer on this anywhere.

4
  • You want to hide only for sitecollection icons? If yes than you can hide the div by finding class ms-srch-item-previewContainer
    – Ravindra
    Aug 18 '17 at 8:09
  • Which version of SP you are working with? if 2013+ best way would be to develop a custom display template. Aug 18 '17 at 10:41
  • Which display template are u using? Aug 18 '17 at 11:08
  • I'm using the "Site Item" display template
    – Adam G.
    Aug 18 '17 at 19:10
2

Alternatively you can change Item template of content search webpart. Edit the webpart and set item template under display template as "Two lines" which will not display any images.

enter image description here

OutPut:

enter image description here

1

Thanks to all that commented and answered! It pushed me in the right direction!

What most were suggesting was to use another display template or to create a custom display template. So that's what I did.

custom display template

This is a copy from the original display template I was using, "Site Item" (or Item_Site.html) In the copy, that I renamed "Item_Site_noLogo.html", I went in and poked around until this change to the code gave me what I wanted:

/*if(!$isNull(ctx.CurrentItem.SiteLogo) && !Srch.U.isDefaultSiteLogo(ctx.CurrentItem.SiteLogo)){ 
                ctx.CurrentItem.csr_PathLength = Srch.U.pathTruncationLengthWithPreview;
                ctx.CurrentItem.csr_PreviewImage = ctx.CurrentItem.SiteLogo;
                ctx.CurrentItem.csr_PreviewImageAltText = Srch.Res.hp_Alt_SiteLogo;
            } else {
                deepLinksClassNoEncode += " ms-srch-item-deepLinks-noPreview";
            }
            */
            deepLinksClassNoEncode += " ms-srch-item-deepLinks-noPreview";

I just commented out the section that grabs the site icon and so any result won't show a preview.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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