Wednesday, February 16, 2011

Adding Top Link bar to SharePoint Basic Search Center Template

The Basic Search Center template in SP Foundation 2010 uses the minimal.master master page rather than the v4.master.  The search center template actually requires some additional content placeholders that the v4.master does not support.  I recently needed to add the Top link navigation to this template and decided to add the lines to the minimal.master to achieve this functionality.  Editing the master page allowed the change to persist to the results.aspx page as well which was the desired functionality.  To make the change, open the minimal.master page using SP Designer 2010 and find the following lines:

 <h3 class="s4-mini-header">
    <asp:ContentPlaceHolder id="PlaceHolderPageSubTitle" runat="server" />
   </h3>
  </div>
 </div>

The last line should be around line 118.  After the closing div tag add the following (Do not replace, just add):

<div id="s4-topheader2" class="s4-pr s4-notdlg">
     <a name="startNavigation"></a>
     <div class="s4-rp s4-app">
     </div>
     <div class="s4-lp s4-toplinks">
      <asp:ContentPlaceHolder id="PlaceHolderTopNavBar" runat="server">
        <asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">
 <SharePoint:AspMenu
   ID="TopNavigationMenuV4"
   Runat="server"
   EnableViewState="false"
   DataSourceID="topSiteMap"
   AccessKey="<%$Resources:wss,navigation_accesskey%>"
   UseSimpleRendering="true"
   UseSeparateCss="false"
   Orientation="Horizontal"
   StaticDisplayLevels="2"
   MaximumDynamicDisplayLevels="1"
   SkipLinkText=""
   CssClass="s4-tn"/>
 <SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
  <Template_Controls>
   <asp:SiteMapDataSource
     ShowStartingNode="False"
     SiteMapProvider="SPNavigationProvider"
     id="topSiteMap"
     runat="server"
     StartingNodeUrl="sid:1002"/>
  </Template_Controls>
 </SharePoint:DelegateControl>
        </asp:ContentPlaceHolder>
      </asp:ContentPlaceHolder>
     </div>
    </div>