none
Site link RRS feed

  • Question

  • HI - I've downloaded a Search display template where there's this line:  

    <b>Site:</b><a href="_#=ctx.CurrentItem.SitePath=#_"> _#=ctx.CurrentItem.SiteTitle=#_ </a>

    it Displays the link correct but the URL is wrong 

    http://portal/sitename/sitepages/;portal./sitename/sitepages/

    What's missing?  


    • Edited by JmATK Thursday, December 22, 2016 2:33 PM
    Thursday, December 22, 2016 9:47 AM

Answers

  • Hi,

    Please change follow line of code

    <b>Site:</b><a href="_#=ctx.CurrentItem.SitePath=#_"> _#=ctx.CurrentItem.SiteTitle=#_ </a>

    to

    <b>Site:</b><a href="http://_#=ctx.CurrentItem.SitePath.split(';')[1].replace('.','')=#_"> _#=ctx.CurrentItem.SiteTitle=#_ </a>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by JmATK Friday, December 23, 2016 5:57 AM
    Friday, December 23, 2016 5:34 AM
    Moderator

All replies

  • Hi,

    These are default search display template, please do not change anything on this, if you plan to use this template for your search result.


    Murugesa Pandian | MCPD | MCTS | SharePoint 2010 |

    Thursday, December 22, 2016 1:47 PM
  • Hi Murangesa 

    Nope its a custom template from here http://searchexplained.com/custom-document-search-experience-display-template/ 

    Thursday, December 22, 2016 1:54 PM
  • hi JmATK,

    Still you don't want to change anything between _# =variable _#


    Murugesa Pandian | MCPD | MCTS | SharePoint 2010 |

    Thursday, December 22, 2016 2:31 PM
  • how/what do I then change so the link is correct ? 
    Thursday, December 22, 2016 2:33 PM
  • Hi,

    Please change follow line of code

    <b>Site:</b><a href="_#=ctx.CurrentItem.SitePath=#_"> _#=ctx.CurrentItem.SiteTitle=#_ </a>

    to

    <b>Site:</b><a href="http://_#=ctx.CurrentItem.SitePath.split(';')[1].replace('.','')=#_"> _#=ctx.CurrentItem.SiteTitle=#_ </a>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by JmATK Friday, December 23, 2016 5:57 AM
    Friday, December 23, 2016 5:34 AM
    Moderator
  • Thanks Dennis - that did it !

    Best wishes for a wonderful holiday season, and a very happy New Year!
    Friday, December 23, 2016 5:59 AM