How to use same consistent Top Navigation across Different Site Collections
Let’s talk about Branding Master pages with different look and feel and completely different from out of box MOSS site
First step would be to copy any existing Master Page and start on that as a base for new Master Page. Master pages contains your navigation (Top and Bottom), Site Action menu, search box and few other bits.
Second would be to create a copy of .net page (welcome page) and work on it to move the layout of your webparts across that page.
If you have seperate Site Collections defined on your server and you wish to use the consistent navigation across all Site collections then that can be done by using steps below.
Default Sharepoint Top navigation is defined by MOSS and uses your sites under the particular site collection.
Let’s say you have tow Site Collection A and B
Site collection A has links A1, A2 and Site collection B has link B1 and B2.
What you are trying to do is to change the master page so that on both site collections so that you have all the links on top navigation which is (A1, A2, B1, B2)
Below is how you do it with Microsoft.SharePoint.Navigation.SPXmlContentMapProvider
Add the following to your web.config(s) under the under the <sitemap> <providers> node
<add name=”MyCustomXmlContentMapProvider” siteMapFile=”/_layouts/custom/customtopmenu.sitemap” type=”Microsoft.SharePoint.Navigation.SPXmlContentMapProvider, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” />
Note: SiteMapFile locations can be any locations which can be accessed by Sharepoint
In the same website(s), add a customtopmenu.sitemap file with the following structure
<siteMap>
<siteMapNode title=”Home Page” url=”http://sitecollectionA/“>
<siteMapNode title=”A1″ url=”http://sitecollectionA/A1“>
<siteMapNode title=”SubLink” url=”http://sitecollectionA/A1/sublinkA1″/>
</siteMapNode>
</siteMapNode>
<siteMapNode title=”A2″ url=”http://sitecollectionA/A2″></siteMapNode>
<siteMapNode title=”B1″ url=”http://sitecollectionB/B1″></siteMapNode>
<siteMapNode title=”B2″ url=”http://sitecollectionB/B2″></siteMapNode>
</siteMap>
This file will control the actual contents of the top navigation.
Open and Modify your master page, add the following below the existing SharePoint:DelegateControl
<SharePoint:DelegateControl runat=”server” ControlId=”TopNavigationDataSourceNew”>
<Template_Controls>
<asp:SiteMapDataSource
ShowStartingNode=”false”
SiteMapProvider=”MyCustomXmlContentMapProvider”
id=”xmlSiteMap”
runat=”server”
/>
</Template_Controls>
</SharePoint:DelegateControl>
Modify the master page, locate SharePoint:AspMenu, with ID=TopNavigationMenu and Now change the DataSourceID from “topSiteMap” to “xmlSiteMap”.
All done – Now save and try to run the page. You should the navigation you have defind in the XML file. If you have to change the navigation, you have to modify the XML file because it is now controlled by the XML file.
Repeat the steps above for different site collections to have consistent navigation across all site collections.
Be the first to comment - What do you think?
Posted by Tosh -
April 13, 2010 at 12:30 pm
Categories: Branding, Code Samples Tags: Consistent navigation, Master Page, MOSS 2007, Navigation, Sharepoint