How to Create and Store Master Pages on the Server for Use with Site Collections

This article refers to Microsoft Office SharePoint Server 2007 (MOSS
2007) Beta 2 Tech Refresh.   Details are subject to change in the RTM

One way master pages can be stored and used in MOSS 2007 sites is through
creation in SharePoint Designer and storage in the Master Page Gallery.
This method will create a master page in the content database.  But what if
you need to use one or two master page across multiple site collections?  For ease
of updates and maintenance, we don’t necessarily want to store a copy of the master page in
each site collection. Instead we can create and store master pages on the file
system and make them available for new site collections.

PLEASE NOTE, this is for new site collections that have not been created yet,
these instructions will not work for site collections that have
already been
.  This
process will only work for site collections created in SharePoint Central Admin.
Creating a site through the Create Site option in the portal will show
your custom master page.

Below is one way to create master pages on the server, but there is a
better recommended way of accomplishing this via using a SharePoint Feature
Please reference my other article about this for instructions on how to create
this functionality as a Feature:

Create a Feature: Master Pages for Site Collections

How to Add Master Pages to the Web Server for Use with Newly Provisioned
Site Collections

  1. Navigate to the master page storage location on your web server:
    Local Drive:Program FilesCommon
    FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURESPublishingLayoutsMasterPages
  2.  Copy one of the existing master pages, paste the copy in the
    directory, and rename the copy to your unique name.  Alternately paste
    in your custom master page, or create a new blank file with the extension of
    Location of the master pages on the web serverTip! To just get a master page going,
    copy the sample code
    from this
    and paste it in your custom master page file.  That will
    get you up and running for this article and give you a good starting point
    for your customizations once the master page has been applied to your site.
  3. Navigate to the Publishing Layouts XML file in the PublishingLayouts
    Local Drive:Program FilesCommon
    FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURESPublishingLayouts
  4.  Locate and make a backup copy of ProvisionedFiles.xml.
    Keep this backup in a safe location.
  5. Open ProvisionedFiles.xml in Notepad or a similar
    editing application.
  6.  Locate the OSGMasterPages Module tag:
  7. Locate a FILE tag block within the Module tags, copy and paste at the
    end of the File tags and before the closing Module tag.
    Copy and paste the FILE tag block
  8. Update the properties to reflect the new master page details:
    1. Change the URL to your custom master page.
      <File Url=”Sample.master” Type=”GhostableInLibrary”>
    2. Change the Preview Images to a custom image.
      <Property Name=”PublishingPreviewImage” Value=”~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview
      Images/Sample.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview
      Images/Sample.png” />
      Add the custom image to the following directory:
      Local Drive:Program FilesCommon
      FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURESPublishingLayoutsen-us
    3. Update the Description.  Enter a description for
      your master page.
      <Property Name=”MasterPageDescription” Value=”Here
      is my sample description”
  9. In the next Module, PublishingLayoutsPreviewImages,
    create an entry for the preview image by copying and pasting and existing
    FILE tag and updating the properties.
    <File Url=”Sample.png”
    Name=”Preview Images/Sample.png” Type=”GhostableInLibrary”>
  10.  Navigate to SharePoint 3.0 Central Administration on the web
    server and create a new Site Collection using the Publishing Portal
    Collaboration Portal site template.
  11. Open your new site and change the master page the site uses:
    1. Go to Site ActionsSite Settings
      Modify All Site Settings
      Master page (under the Look and Feel submenu)
    2. Depending on your requirements, in either or both the Site
      Master Page
      setting and the System Master Page
      setting, select your drop down box and choose your custom master page.

      Master page selection drop down

    3. Select OK.
  12. Reset IIS on the web server (Command Prompt – IISRESET).

In my next article I will cover what to do next with your custom master
page and how do you start customizing it.

Dustin Miller and Heather Solomon from SharePoint Experts