Question

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.

Était-ce utile?

La solution 2

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

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top