Forum Discussion

JoostvdLinden's avatar
JoostvdLinden
Brass Contributor
Nov 19, 2018
Solved

SharePoint Online Search Image URL

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

  • 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

  • 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

    • JoostvdLinden's avatar
      JoostvdLinden
      Brass Contributor
      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.
      • Modadm2k22's avatar
        Modadm2k22
        Copper Contributor

        JoostvdLinden 

         

        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.

         

Resources