SOLVED

SharePoint Online Search Image URL

%3CLINGO-SUB%20id%3D%22lingo-sub-288974%22%20slang%3D%22en-US%22%3ESharePoint%20Online%20Search%20Image%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-288974%22%20slang%3D%22en-US%22%3E%3CP%3EDear%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3BI%20have%20created%20a%20classic%20SharePoint%20page%20in%20SharePoint%20Online%20and%20added%20the%20Search%20Results%20Web%20Part%20to%20it.%3C%2FP%3E%3CP%3EI%20have%20configured%20the%20Search%20Results%20Web%20Part%20to%20result%20images%20from%20a%20specific%20document%20library.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20I%20find%20unfortunate%2C%20is%20when%20I%20click%20on%20a%20result%2C%20it%20opens%20the%20DispForm.aspx%20and%20therefore%20shows%20all%20properties%20of%20the%20image%2C%20an%20not%20the%20image%20itself!%3C%2FP%3E%3CP%3EIt%20navigates%20to%20this%20Path%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fx.sharepoint.com%2FFoto%2FForms%2FDispForm.aspx%3FID%3D92%26amp%3BRootFolder%3D%2FFoto%2Fkerstfeest%25202016%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fx.sharepoint.com%2FFoto%2FForms%2FDispForm.aspx%3FID%3D92%26amp%3BRootFolder%3D%2FFoto%2Fkerstfeest%25202016%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20using%20the%20out%20of%20the%20box%20Display%20Template%20and%20Result%20Type.%3C%2FP%3E%3CP%3EHow%20could%20I%20overcome%20this%20issue%3F%20I%20want%20SharePoint%20to%20follow%20the%20'PictureURL'%20instead%20of%20'Path'.%20I%20tried%20looking%20into%20the%20Display%20Templates%20and%20several%20web%20articles%2C%20but%20for%20me%20that%20is%20like%20finding%20a%20needle%20in%20a%20haystack.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20all%20help%20provided!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKind%20regards%2C%3C%2FP%3E%3CP%3EJoost%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-288974%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDispForm%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPicture%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Esearch%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-292091%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20Online%20Search%20Image%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-292091%22%20slang%3D%22en-US%22%3EThanks%20for%20your%20reply%20Thomas!%3CBR%20%2F%3EI%20have%20now%20managed%20to%20work%20this%20out.%20By%20accident%20I%20was%20trying%20to%20make%20this%20work%20using%20the%20Item_Default.html%20Display%20Template%2C%20but%20it%20should%20have%20changed%20the%20Item_Picture.html%20file.%3CBR%20%2F%3ENow%20it%20does%20no%20longer%20navigate%20to%20the%20DispForm.aspx%2C%20but%20the%20the%20PictureUrl%20path%20instead.%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-291687%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20Online%20Search%20Image%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-291687%22%20slang%3D%22en-US%22%3E%3CP%3EWhat%20I%20would%20do%20is%20download%20that%20item%20display%20template%2C%20then%20simply%20find%20where%20it%20injects%20the%26nbsp%3BPath%20managed%20property%20and%20replace%20it%20with%20your%20PictureUrl%20property.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAt%20the%20top%20of%20the%20display%20template%20in%20the%26nbsp%3B%3CSPAN%3Emso%3AManagedPropertyMapping%26nbsp%3Bsection%2C%20make%20sure%20to%20include%20'PictureUrl'%3APictureUrl%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-485773%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20Online%20Search%20Image%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-485773%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F3953%22%20target%3D%22_blank%22%3E%40Joost%20van%20der%20Linden%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20do%20this%20on%20Modern%20experience%20search%3F%20User%20is%20redirected%20to%20DispForm.aspx%20when%20searching%20for%20images%20in%20the%20TOP%20left%20serach%20box.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-486129%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20Online%20Search%20Image%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-486129%22%20slang%3D%22en-US%22%3E%3CP%3EHik%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F73555%22%20target%3D%22_blank%22%3E%40Ale%C5%A1%20%C5%A0avli%3C%2FA%3E%2C%3C%2FP%3E%3CP%3EI%20don't%20think%20so%20using%20out%20of%20the%20box%20modern%20web%20parts.%3C%2FP%3E%3CP%3EI%20think%20it%20would%20require%20a%20modern%20custom%20SPFX%20web%20part%20to%20make%20this%20way.%20But%20this%20is%20a%20whole%20different%20ball%20game.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional 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

4 Replies
Highlighted
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

Highlighted
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.
Highlighted

@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.

Highlighted

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.