Tag: Global Navigation

How to add global navigation in SharePoint 2010 Fast or Enterprise Search Center Sites

This post describes how we can add global navigation in SharePoint 2010 Search Center sites.

Search center sites use minimal master page which doesn’t include global navigation controls. Even if we change site’s master page (To change master page, publishing feature has to be activated) from minimal to v4 or nightandday global navigation will not appear and we’ll see some strange results like search textbox going behind the ribbon. The reason for this is that the controls which render global navigation are not in minimal master page, they are in page layouts. So let’s start our short journey.

Step 1: Open root site in SharePoint Designer, go to All Files, _catalogs and then masterpage

Step 2: We’ve to change SearchMain.aspx (default page containing search text box), SearchResults.aspx (which shows search results) and AdvanceSearchLayout.aspx (which has advance search controls) respectively

Step 3: Let’s start with SearchMain.aspx, click this file, edit it and then click Advance mode button at the top so we can do the desired changes.

Step 4: Search for srch-sb-main, we’ve to paste the following code which renders the global navigation before div with class srch-sb-main

<div class="s4-lp s4-toplinks" style="background-image:url(/_layouts/images/selbg.png); background-repeat:no-repeat;
repeat-x:left top; background-color:#f6f6f6; vertical-align:middle; min-height:25px; border-top:1px solid #e0e0e0;
border-bottom:1px solid #b8babd">

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

</div>

Step 5: Let’s save our page and view it in browser.

Step 6: Okay we got our global navigation on search page, now let’s add it in search results page. So let’s edit SearchResults.aspx in advance mode

Step 7: Search for srch-sb-results, we’ve to paste the code from step 4 which renders the global navigation before div with class srch-sb-results

Step 8: Search for PlaceHolderMain, we’ve to paste the code from Step 4 which renders the global navigation inside the content place holder with id PlaceHolderMain