DotNet Development, SharePoint Customizing, Silverlight, MS Infrastructure and other tips and tricks

How to create a Custom Site Definition

Posted by PANVEGA on November 26, 2007


A site definition defines a unique type of SharePoint site. There are five site definitions natively installed in Windows SharePoint Services. A site definition can include more than one site definition configuration. SharePoint Web sites are based on particular site defnition configurations.

  • STS includes the site definition configurations for Team Site, Blank Site, and Document Workspace.
  • MPS includes the site definition configurations for Basic Meeting Workspace, Blank Meeting Workspace, Decision Meeting Workspace, Social Meeting Workspace, and Multipage Meeting Workspace.
  • CENTRALADMIN provides a site definition configuration sfor central administration Web sites.
  • WIKI provides a site definition configuration for Web sites that support community content using wiki technology.
  • BLOG provides a site definition configuration for blogs.

Each site definition consists of a combination of files that are placed in the \\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE subfolders of front-end Web servers during installation of Windows SharePoint Services. Site definition files include .xml, .aspx, .ascx, and .master page files, as well as document template files (.dot, .htm, and so on), and content files (.gif, .doc, and so on).

You can create a custom site definition by copying an existing site definition and then modifying the copy.

–> In this example I copied the Blog Site to a CustomBlog Site.

The WEBTEMP.XML Copy and Modification

The WEBTEMP.XML file contains the site definitions that are available on the Template Selection page for site creation. You never want to make modifications to the original WEBTEMP.XML file since upgrades and service packs can potentially overwrite any changes you have made.

Instead you create a copy of the WEBTEMP.XML file and append a unique name on the end. At run time the compiler merges all the information in the WEBTEMP*.XML files. So now we need to create our own WEBTEMP.XML file for our custom site definition so it will be available on the Template Selection page.

  • Go to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates
  • Copy the Blog Site and rename it for e.g. CustomBlog
  • Navigate to the following directory on your SharePoint server:
    Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML
  • Copy the WEBTEMP.XML file and paste it in the same directory (Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML).
  • Give the file a unique name by appending a string to the name of the original file; for example, WebTempBlog.xml. At run time, the compiler merges information contained in this file with the information contained in the original file to specify which site definition configurations are available for creating new sites.
  • Open your new XML file (WebTempBlog.XML) in Notepad, an XML editor or a code editor.
  • Each WebTemp.xml file contains a collection of Template elements and Configuration subelements, which identify to the compiler all the site definition configurations that can be instantiated. The Configuration element defines, for example, a title, a description, the URL for the image displayed in the user interface (UI), and a display category that specifies the tab on which to display the template in the Template Selection section of the New SharePoint Site page.
  • Delete here all code between the TEMPLATEs tags. (only fot this simple example!)
  • In each Template element defined in the WebTemp file, the Name attribute must contain the same name that is assigned to the new folder. Also, to avoid conflict with IDs already used in Windows SharePoint Services, use unique values greater than 10,000 for the ID attribute.

The following example defines a single site definition.

<Template Name=”CUSTOMBLOG” ID=”10001“>
<Configuration ID=”0″ Title=”CustomBlog” Hidden=”FALSE”
Description=”A site for a person or team to post ideas,…”
DisplayCategory=”Collaboration” >

Notes about this code:

    TEMPLATE Element

    • The Name attribute must match your site definition folder name. It must match the name exactly and it is case sensitive. Use UPPERCASE.
    • The ID attribute must be unique and greater than 10,000.


    • ID is required and specifies a unique ID for the configuration.
    • Title is the name that appears on the Template Selection page. Your custom site definitions will appear under the default SharePoint list of Team Site, Document Workspace, etc.
    • Type is optional and identifies the configuration with a specific site definition.
    • Hidden specifies whether the site configuration appears as an option on the Template Selection page in SharePoint.
    • ImageURL is the large image you see on the Template Selection page. You can leave this as the default that SharePoint uses, or specify your own file. A way to use this would be to take a screenshot of the final site definition, create an image file suitable for the Template Selection screen, and specify that for this image so when the user is selecting a template upon site creation, they have a visual cue as to which template this one is.
    • Description is the text description that appears under the image on the Template Selection page. The description should describe the purpose or intended use of the template.
  • You may need to reset Internet Information Services (IIS) to cause the new definition configuration to appear as an option in the UI. To do this, enter iisreset at a command prompt.
  • Got to Site Actions –> Create Site under Collaboration for example you find the CustomBlog Site.


When Windows SharePoint Services 3.0 ships there are two tabs on the selection box in the Template Selection section of the New SharePoint Site page: “Collaboration” and “Meetings”. If you create a custom site template by saving an existing site as a template, then a third tab, called “Custom” will appear in the box.

If you use any value other than “Collaboration”, “Meetings”, or “Custom” as the value of the DisplayCategory attribute of a Configuration element in a WebTemp*.xml file, then a new tab with the new value as its name will appear in the box.

Read more


One Response to “How to create a Custom Site Definition”

  1. Funzel said


    any idea how we can sort the Display category (tab sequence) ?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: