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.

11 thoughts on “How to Create and Store Master Pages on the Server for Use with Site Collections”

  1. Is there a way other than the gui to specify that a page should use the new master page through sharepoint designer or via editing a file on the file system(i.e. on form.aspx or viewpage.aspx)?

  2. Hi Heather, Is there anyway possible to force a master page farm wide? This articles helps, as you said, only for newly created sites. In our case, we have a few existing portals in which I’d like to apply a custom master page to. However, I only want to work with one copy of the master page. I realize I can add the MP to the MP Gallery and apply to each site, but I’d rather only work with one version.Cheers!

  3. I do agree your scenario works on MOSS, but unfortunatelly i was not able to find the ProvisionedFiles.xml file on my WSS installation.

  4. re: the satement above: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.When I read this I thought it was a typo – sounded like you meant to say:Creating a site through the Create Site option in the portal will NOT show your custom master –I have tried this both ways and this is what I found:If I create the site from central admin it shows up for either drop down BUT If I create the site from the “create site” link on my preprovisioned site and go in to assign the master page – the masterpages that I added to the ProvisionedFiles.xml file on the file system – are NOT in the drop down for the sites master page. HOWEVER – they do show up under the System Masterpages area (guess that makes sense)So – the nut of it is…no old sites – but all new ones (from central admin – or not) will be able to see it.would you say that is correct?

  5. Heather,Have you managed to find a solution so that the default master page when a site is created is your customised version i.e. we have enabled self service site creation and we want all sites created by the business to automatically use the custom master page and not the let the user choose. We have tried removing all master pages from the template gallery but SharePoint looks at the 12 hive and if we change the default.master (AFTER backing up) in the 12 hive templates, this then applies the revised Master page to the Central Admin site which we don’t wantThanksTom

  6. In my case I could only get it working by creating the site through Sharepoint Central Administration.PD: Don’t forget that “Office SharePoint Server Publishing Infrastructure” service must be activated (It is under Site Collection Features) otherwise the new masterpage would not be available in the Combo Box. :P. I spent some hours with that

  7. It did not work for me. I followed the steps which you have given above and created a site collection using central administration. But the new master page is not displayed in the combo box

  8. HI I am trying to follow the steps mentioned but i am not able to see the link for MOdify All Site Settings I find Go to Site Actions- Site Setting and after that i am not able to see the link for Modify All Site Settings.Please help me…

Comments are closed.