SOLVED

SharePoint Online Search Image URL

Brass Contributor

Dear all,

 

 I have created a classic SharePoint page in SharePoint Online and added the Search Results Web Part to it.

I have configured the Search Results Web Part to result images from a specific document library.

 

What I find unfortunate, is when I click on a result, it opens the DispForm.aspx and therefore shows all properties of the image, an not the image itself!

It navigates to this Path: 

https://x.sharepoint.com/Foto/Forms/DispForm.aspx?ID=92&RootFolder=/Foto/kerstfeest%202016

 

I am using the out of the box Display Template and Result Type.

How could I overcome this issue? I want SharePoint to follow the 'PictureURL' instead of 'Path'. I tried looking into the Display Templates and several web articles, but for me that is like finding a needle in a haystack.

 

Thanks for all help provided!

 

Kind regards,

Joost

5 Replies
best response confirmed by Joost van der Linden (Brass Contributor)
Solution

What I would do is download that item display template, then simply find where it injects the Path managed property and replace it with your PictureUrl property.

 

At the top of the display template in the mso:ManagedPropertyMapping section, make sure to include 'PictureUrl':PictureUrl

Thanks for your reply Thomas!
I have now managed to work this out. By accident I was trying to make this work using the Item_Default.html Display Template, but it should have changed the Item_Picture.html file.
Now it does no longer navigate to the DispForm.aspx, but the the PictureUrl path instead.

@Joost van der Linden 

Is there a way to do this on Modern experience search? User is redirected to DispForm.aspx when searching for images in the TOP left serach box.

Hik @Aleš Šavli,

I don't think so using out of the box modern web parts.

I think it would require a modern custom SPFX web part to make this way. But this is a whole different ball game.

@Joost van der Linden 

 

Hi there

 

Appreciate that this is some time ago, but I don't suppose you could provide an example of the modification that you made to get this to work please?

 

I have tried adding 'PictureUrl':'PictureUrl' into the template and 'Path':'PictureUrl' have had no luck so far.

 

Any insight you can provide would be most appreciated.

 

Thanks.

 

1 best response

Accepted Solutions
best response confirmed by Joost van der Linden (Brass Contributor)
Solution

What I would do is download that item display template, then simply find where it injects the Path managed property and replace it with your PictureUrl property.

 

At the top of the display template in the mso:ManagedPropertyMapping section, make sure to include 'PictureUrl':PictureUrl

View solution in original post