Tuesday, September 25, 2012

How To Apply a Custom Master Page to a Site Template in SharePoint 2010

In this example, the original team site that was used as a template had the custom master page applied to it when I implemented the custom master page in the root site and selected “reset all subsites” in the process. Therefore, I thought all I had to do was create a new template from the updated site that included the new master page. The new template created easily enough, as did a new site from the template that you could update and navigate though. However, the Site Settings Page threw an error. A site is pretty useless if you can’t access its settings.
 

Solution Overview

Here’s what I finally did to resolve this issue:
1. “Cleanse” the TeamSiteTemplate (i.e. the “master site”) site by returning the master page to v4.master
2. Create a custom master page within the TeamSiteTemplate site using SPD
3. Apply the new master page as the Default master page using SPD
4. Create a new template
 

Solution Details

“Cleanse” the TeamSiteTemplate Site by Returning the Master Page to v4.master

1. Hack into the Site Master Page page by typing the following URL into the browser: http://YourSharepointSite/TeamSiteTemplate/_Layouts/ChangeSiteMasterPage.aspx
Note: There is no Master Page link under Look and Feel in a Team Site since having a choice of master pages is a publishing feature.
2. Select v4.master for both the Site and System master pages
3. Select Use Microsoft SharePoint Foundation default styles for the Alternate CSS URL
4. Click OK
 

Create a Custom Master Page within the TeamSiteTemplate Site

First open the root site in SPD in order to copy the code from the master page:
1. Open http://YourSharepointSite/ in SPD (i.e. the root site)
2. In the left navigation pane select All Files > _catalogs > masterpage
3. Right-click Custom.master and select Edit File in Advanced Mode
4. Select No when prompted for check out (we’re not making changes, just copying code)
5. Place your cursor in code view and CTRL-A to select all of the code, then CTRL-C to copy it
Navigation.png
Next open the team site in which you need to apply the custom master page:
6. Open http://YourSharepointSite/TeamSiteTemplate in SPD
7. In the left navigation pane select Master Pages
8. In the ribbon select Blank Master Page

MasterPage.png

9. Place your cursor in code view and CTRL-A to select all of the code, then CTRL-V to overwrite it with the copied code from Custom.master
10. Save and close the new master page as Custom.master
Apply the new master page as the Default master page
1. Right-click Custom.master and select Set as Default Master Page
2. Close SPD and return to the browser
Create a new template
1. Return to http://YourSharepointSite/TeamSiteTemplate in the browser
2. Refresh the page to ensure the changes made in SPD are picked up in the browser
3. Select Site Actions > Site Settings
4. Under Site Actions select Save site as template
5. Complete the following:
a. File name: YourSiteTemplate
b. Template name: Your CUSTOMSite Template
c. Template description: Contains Policies and Procedures, Reports and Forms libraries and included custom master page
6. OK

By using SharePoint Designer to ensure that the custom master page is applied directly within your custom site template, you can assist users in keeping branding consistent within your SharePoint environment.

No comments:

Post a Comment