Content Search WebParts Picture URL

Iron Contributor

Hello, 

 

I am working on a Content Search Web Part (on SharePoint Online) to fetch some sites. They are displyed as 3 lines on right and picture on left. The pictureURL uses 'SiteLogo' option to display the site logo.

 

It works fine, if the site has custom logo uploaded. However, if it's not there then it displays the grey image with question mark on it. 

 

The placeholder with colored image and site Initials shows up, if the group sites are fetched and they dont have the logo or if the same query (for fetching SharePoint sites) in search on SharePoint Home page (the page that opens up when login on to owa has the sites we are following , recent and featured link).

 

So, Is it possible to fetch the place holder like the colored background with site Initials for the regular SharePoint sites as is displayed on the search page?

 

 

Thank you.

3 Replies

Why not just create a custom item display template and then check the value of the url. If it is blank set it to a url of an image that you would like to display.

Thank for the response.

However, I don't think creating a custom item display template will do it.

I just want to know how can I fetch the site initials with color background logo (default logo of the sharepoint site) for a regular SharePoint site, which doesn't have any logo uploaded.

According to me, it is the property mapping for Picture URL. I am not sure which one of the attributes will provide me the desired results.

I am currently mapping 'SiteLogo' to the Picture URL which displays the site logo (if uploaded) and grey image(if not uploaded) for regular SharePoint site and color background with initials (if no logo uploaded) for O365 groups.
If no logo is uploaded you might end up with a blank url. Hence some logic that is needed
If logo =null then
logourl = urltodefaultlogo