Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

My company has just stated using SharePoint 2010 and I have been tasked with adding some custom functionality to the master pages - essntially we just want a global top navigation bar that contains links to the various different sites, e.g. //instranetname/ , //intranetname/sites/site1 , //intranetname/sites/site2 etc.

At the moment, I have achieved this by creating a custom master page for each site (copying all the content from v4.master), and adding a just above the normal top navigation bar, with some links in it, and the styles hardcoded in. This is working so far, but it means that every time a link is added/modified, I have to make the same change to each of the four sites (and this number will increase with time).

My question is twofold:

1) Is there a way to make a single custom global master page and set all sites and subsites to use it?

and if not...

2) Is there a way to make a custom control (I'm thinking in terms of an ASP.NET web forms control), and make all the sites use it?

Thanks in advance for your help,

Steve

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Of the above solutions , though robust - they will deal with working your way around visual studio. I had exactly the same kind of requirement a year back and it was addressed like this :-

A global top navigation that is consistent across all site collections and different web applications.

Secondly, the link management was in a way that whenever a new link is added or existing link is modified, it happens only once and the change is reflected in top navigation across the entire site collections and web applications in the farm.

No webpart or wsp was created to achieve the same.


These were the exact stepsto achieve the same:-

  1. A primary site collection on web application running on port 80 was decided to be landing area for the users. Lets call it http://myportal/

  2. We have created xml file known as portalnav.xml uploaded in the pages library of http://myportal. This contains the defined navigation and their respective url. A sample of the same is mentioned in the screenshot below

  3. xml screenshot

  4. We needed to add a XML datasource to the masterpage named portal.master and bind the sharepoint top navigation to this datasource.

<SharePoint:XmlUrlDataSource runat=server id=XmlUrlDataSource1 selectcommand=``http://myportal/Pages/portalnav.xml AuthType=Basic AuthUserName=domain\userid" AuthPassword=enter the password of the site administrator here/>

    <SharePoint:AspMenu
  ID=TopNavigationMenuV4
  Runat=server
  EnableViewState=false
  DataSourceID=XmlUrlDataSource1
  AccessKey=<%$Resources:wss,navigation_accesskey%>
  UseSimpleRendering=true
  UseSeparateCss=false
  Orientation=Horizontal
  StaticDisplayLevels=2
  MaximumDynamicDisplayLevels=5
  SkipLinkText=
  CssClass=s4-tn>
    <DataBindings>
                                                <asp:MenuItemBinding DataMember=Menu TextField=text ValueField=text NavigateUrlField=url
                                                 />
                                                <asp:MenuItemBinding DataMember=SubMenu  TextField=text NavigateUrlField=url
                                                    ValueField=text />
                                            </DataBindings>

    </SharePoint:AspMenu>

                                    <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> `
  1. Once this xml file is published and approved , apply the changes to the masterpage and apply this masterpage(portal.master) across any site collections across the entire farm. It should work just fine. The logic behind this is fairly simple -

1) An XML Datasource binded to the sharepoint default top navigation.

2) The path of the datasource is referred by all the site collections through the masterpage and authenticated by the primary site collection(http://myportal) administrator's user account.

3) This way it is a centrally located and managed navigation however with security concerns as the credentials are passed in plain text. Since only farm admins have access to the site settings in our case, this was given a green flag from the security standpoint.

share|improve this answer

I'd do both see the Packaging and Deploying SharePoint Branding section of Real World Branding with SharePoint 2010 Publishing Sites for guidelines on how to move a developed MasterPage into Visual studio to deploy as a WSP.

This will deploy the master page to the file system with a link to it from the Master Page gallery each Site collection, but if anyone goes into the Master Page Gallary and modifies the master page that link is not used anymore.

So I'd also develop a ASP.NET control in the same project and use that in the master page. The easiest would probably be to just create a User Control

share|improve this answer
1  
And while you are at it, remember to configure SharePoint Designer settings for your web application to not allow Master Pages and Page Layouts to be customized with SharePoint Designer. This will avoid that your master page etc gets customized so that the file on the file system isnt used anymore: Central Administration > General App Settings > SharePoint Designer Settings –  Anders Rask May 18 '12 at 11:44

The simple way to achieve this is :

  • Update your master page to be used across all site collections (e.g. create a solution package download from this link, replace as needed http://msdn.microsoft.com/en-us/library/gg447066.aspx - this is a Sandbox solution, but changing from VS2010 could make it a farm solution). To configure the use of the same master page - the solution attached provides a WebProvisioned receiver that handles automatic change of the master page for you on sub-sites. You need only to make sure that Site Collection top-level have the feature activated (can be easily achieved either having the feature to activate automatically or via a simple PowerShell).
    • use Delegate Controls - using this technique you could dynamically replace your custom User control (deployed in _CONTROLTEMPLATES physical folder) which displays the global navigation (just by changing the Sequence). Have a look here http://www.spdavid.com/post/2010/01/21/GlobalNavigation-Delegate-Control-in-SharePoint-2010.aspx. You would still need to create your global navigation control that works across Site Collection (if you need it automated) - which is another story.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.