As a SharePoint administrator, if you want to customize your SharePoint sites, the first step is to create a custom site definition with a custom master page.

In order to create a new site definition, you pretty must have two options: design from scratch or copy and edit the existing template. The former will be more difficult than the latter. Designing your own site definition from scratch can be quite challenging if you are not comfortable with what you are doing. In this exercise, I will explain the “easy” way to do this.

1. You need to start with copying the existing site template from. On the server computer, browse to “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\” folder. Each folder represents a site definition. Copy STS folder and paste with new name. In this exercise, we are going to name this site definition “Business” so rename it BUSINESS.

2. In this site definition, a custom master page will be used because in the future, you might want to change the master page of thie site definition and not unghost it. To do this, copy “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\default.master” file to “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\BUSINESS” folder with its name changed to businesscustom.master.

3. Open “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\BUSINESS\default.aspx” file with notepad. In the first line, change
    MasterPageFile=”~masterurl/default.master”
        to
    MasterPageFile=”~masterurl/custom.master”
Doing so will allow the default.aspx file to use the custom master page. Repeat this step for “defaultdws.aspx” file.

4. Open “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\BUSINESS\xml\ONET.XML” file with notepad.

5. Add the following line under <ListTemplates> tag:
     <ListTemplate Name=”mplib” DisplayName=”$Resources:MasterPageGallery;” Description=”$Resources:global_onet_mplib_desc;” SetupPath=”global\lists\mplib” Type=”116” BaseType=”1” Path=”GLOBAL” Hidden=”TRUE” HiddenList=”TRUE” NoCrawl=”TRUE” Unique=”TRUE” Catalog=”TRUE” OnQuickLaunch=”FALSE” SecurityBits=”11” AllowDeletion=”FALSE” AllowEveryoneViewItems=”TRUE” Image=”/_layouts/images/itdl.gif” AlwaysIncludeContent=”TRUE” DocumentTemplate=”100” />

6. Locate the first <Configuration> tag under <Configurations> tag.

7. Change
    <Configuration ID=”0″ Name=”Default”>
        to
    <Configuration ID=”0″ Name=”Default” MasterUrl=”_catalogs/masterpage/businesscustom.master”>
Notice that I am assigning businesscustom.master value to MasterUrl.

8. Locate <Modules> tag under <Configuration ID=”0″…..> tag and add the following tag under <Modules> tag:
    <Module Name=”CustomMasterPage” />

9. Repeat step 6-9 for <Configuration ID=”1″…..> and <Configuration ID=”2″…..> tags.

10. Locate <Modules> tag after </Configurations> and add the following lines to <Modules> tag:
    <Module Name=”CustomMasterPage” List=”116″ Url=”_catalogs/masterpage” RootWebOnly=”FALSE”>
      <File Url=”businesscustom.master” Type=”GhostableInLibrary” IgnoreIfAlreadyExists=”TRUE” />
    </Module>
Notice the file url is the assigned to the custom master page.

11. So far, we have successfully created a site definition. All we have to do now is to register this definition to the site definition list. To do this, create “WEBTEMPBUSINESS.XML” file in “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML” folder. Notice that there exists “WEBTEMP.XML” file in the folder and we are not editing this file. We are creating a new xml file to register a new custom site definition.

12. Open the file with notepad and insert the following lines:
 <?xml version=”1.0″ encoding=”utf-8″?>
 <!– _lcid=”1033″ _version=”12.0.4518″ _dal=”1″ –>
 <!– _LocalBinding –>
 <Templates xmlns:ows=”Microsoft SharePoint”>
  <Template Name=”BUSINESS” ID=”5″>
     <Configuration ID=”0″ Title=”Business Tools Team Site” Hidden=”FALSE” ImageUrl=”/_layouts/images/stsprev.png” Description=”A Business site for teams to quickly organize, author, and share information. It provides a document library, and lists for managing announcements, calendar items, tasks, and discussions.” DisplayCategory=”Corporation”>   
    </Configuration>
     <Configuration ID=”1″ Title=”Business Blank Site” Hidden=”FALSE” ImageUrl=”/_layouts/images/blankprev.png” Description=”A blank Business site for you to customize based on your requirements.” DisplayCategory=”Corporation” AllowGlobalFeatureAssociations=”False” >
    </Configuration>
     <Configuration ID=”2″ Title=”Business Document Workspace” Hidden=”FALSE” ImageUrl=”/_layouts/images/dwsprev.png” Description=”A Business site for colleagues to work together on a document. It provides a document library for storing the primary document and supporting files, a tasks list for assigning to-do items, and a links list for resources related to the document.” DisplayCategory=”Corporation” >
    </Configuration>
  </Template>
 </Templates>
Notice DisplayCategory=”Corporation”; this will create a another tag named Corporation and the three items will be inserted to it. You can change titles, descriptions, and imageUrl’s based on your needs. Save and close the notepad.

13. Last but not least, do an iisreset for the server to recognize the new site definition.

Advertisements