I am running a SharePoint 2010 intranet whose primary purpose is to serve documents to our employees. The majority of these documents are stored in one document library. The problem we are running into is that when a user searches for a document, links to the actual Document Library appear in the results. The project sponsor would like the documents from the library to appear, but not the actual link to the library itself as they do not want users to view it. It this possible?


You'd have to omit it in the search core results xslt. Based on the 2007 core search results, you'd want to look for what outputs the URL and remove it from the XSLT template. In 2007 it would be this:

<p class="srch-Metadata">
<span class="srch-URL">
 <a href="{$url}" id="{concat('CSR_U_',$id)}" title="{$url}" dir="ltr">      
    <xsl:when test="hithighlightedproperties/HHUrl[. != '']">
       <xsl:call-template name="HitHighlighting">
          <xsl:with-param name="hh" select="hithighlightedproperties/HHUrl" /> 
   <xsl:otherwise><xsl:value-of select="url"/></xsl:otherwise> 
 <xsl:call-template name="DisplaySize">
  <xsl:with-param name="size" select="size" />
 <xsl:call-template name="DisplayString">
  <xsl:with-param name="str" select="author" /> 
 <xsl:call-template name="DisplayString">
  <xsl:with-param name="str" select="write" />
 <xsl:call-template name="DisplayCollapsingStatusLink">
    <xsl:with-param name="status" select="collapsingstatus"/>
    <xsl:with-param name="urlEncoded" select="urlEncoded"/>
    <xsl:with-param name="id" select="concat('CSR_CS_',$id)"/>

To eliminate the whole line, you'd get rid of the whole p markup. To just remove the URL and keep the other metadata, you'd remove the span markup. In 2010 the markup is probably different, but the same principle applies.

| improve this answer | |

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.