0

I have a CSWP which I have configured - added a new URL Column and redirected links to the new location. The issue is now getting the links to open in a new window. The new custom column is a text field.

Does anyone have a work around for this one?

  • you want the link to be opened in same tab, in which search results are appearing? – Ovais Khatri Jan 28 '16 at 5:09
  • No - in a new window. – garvon-77 Jan 28 '16 at 20:41
3

If I understand you correctly, I would create a new CSWP display template. That way you can add in the code (shown highlighted in yellow) that will make the link open in a new window.

enter image description here

I usually copy the Item_TwoLines.html display template and modify for my needs. You can find it in the site collection master page gallery > Display Templates > Content Search Web Parts.

If you've never created a display template before, here is one intro but there are plenty of others. https://msdn.microsoft.com/en-us/library/office/jj945138.aspx

  • This is just what I am looking for - I Will give it a go and let you know if I am successful. – garvon-77 Jan 31 '16 at 22:18
  • Hi Robin - just realised the code has been cut off at the ends - would you mind reposting it?? – garvon-77 Feb 1 '16 at 1:00
  • Here is the code you need to replace. In mine this is line 59. <a class="cbs-ItemLink" title="#= $htmlEncode(line1.defaultValueRenderer(line1)) =#" id="#= pictureLinkId =#" target="new"> – Robin Feb 1 '16 at 16:30
  • I am using the Large Picture Display Template - I have added the change to the template - still no success. – garvon-77 Feb 3 '16 at 21:38
  • Can you post your code? – Robin Feb 3 '16 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.