Microsoft SharePoint sites are groups of smart web pages in Windows SharePoint Services (WSS) 3.0 and Microsoft Office SharePoint Server (MOSS) 2007, that let users store, manage, and share data via lists and document libraries. Although SharePoint ships with several site templates that simplify site creation, often administrators want to create a custom template so that users can provision sites that meet their specific needs and become productive faster. There are two ways to customize a template: site templates and site definitions. This overview of site templates and site definitions explains the differences between the two methods and walks you through designing, creating, and customizing SharePoint site templates. This is an extensive subject; I’ve tried to squeeze a lot of information into this article but have barely scratched the surface. I've included references to examples and further reading that will help you dive deeper into the subject.
Site Templates vs. Definitions
A site template is a package that contains a set of differences from a base site definition. Site templates let you use a browser to easily create a template site from an existing SharePoint site. The site, including pages, lists, libraries, and contents, is archived into a single .stp file.
A site definition is a set of files that define the look and feel of a SharePoint site and are stored on the web front-end (WFE) file system in the 12\TEMPLATE\SiteTemplates folder. Creating or modifying site definitions requires programming skills and is far more complicated than using site templates because when creating a site definition, you need to create XML files that describe the site layout and content and package it in a deployment solution.
At some point, most SharePoint administrators will want to change or add certain functionality to the standard site templates. Let’s use the example of a proposal in a document management site that requires certain features. These features aren't included in the standard template. So instead of the user creating a site using the standard document management template and manually customizing the site, he or she can simply use a custom template that has already been created for proposal management.
Site Templates and Site Definitions: Which Should You Use?
So how do you choose between site templates and site definitions when customizing a template? Let's look at some of the pros and cons of each method. The more you understand about the two techniques, the better you'll be able to determine the best method for customizing your sites.
Site Template Pros. Site templates enable administrators to create predefined sites to simplify site provisioning from a user perspective. Sites that are created with them are consistent, which improves usability and maintenance. The pages are stored in just one location—the content database.
Site Template Cons. Because the pages are stored in the content database, performance degradation could occur. Once you create and save a template, you can't update it, which might lead to future product compatibility issues.
Site Definition Pros. Administrators must programmatically create site definitions, giving them more control over site creation. Sites can be provisioned easily—users don’t have to customize them. Site definitions provide greater control over a site's look and feel. Because sites are more consistent, there are fewer user support calls for help.
Site Definition Cons. Creating site definitions requires programming skills (i.e., Visual Studio). Site definitions are costly to maintain. The definition files are stored on each WFE server; therefore, updates must follow change control management processes when multiple WFE servers are involved.
Designing Sites
Many SharePoint administrators think that to create a site, you simply open a template, create some web parts and any needed columns, set up security, and you're done. But you and your users will likely be disappointed if you don't take the time to design a site that provides the functionality to meet the needs of the users. For example, the first step in the design process is to meet with the users to:
· Understand the tasks or job the site will facilitate and support. This will give you insight regarding functionality (their wish list), and its value as mapped to their jobs (business need).
· Identify the web parts required and whether custom web parts or features are required.
· Understand the lingo they use in the job activities and tasks related to the site. This will help you understand how to label the site, web parts, columns, and views, so that they make sense to the user.
Creating Site Templates
The first step in creating a site template is to create the site that will be a base for your template. Note that site templates are created using the SharePoint standard Site Actions pages—Visual Studio isn’t required. This section assumes that you're familiar with adding sites and web parts and adding or modifying columns.
To create your site, open a browser, enter the URL to your SharePoint server, and follow these steps:
1. Select Site Actions, Manage Hierarchy. Right-click the area in the site hierarchy where you want to create a site, and select Add Site.
2. When prompted for a site name, enter TemplateSite, and for the URL, enter TemplateSite, as Figure 1 shows. Select a site template (in our example, Team Site) and click OK. Make note of the URL because it’s required for the next step.
3. To customize the site, enter the site's URL, press enter, and wait for the site to load. Select Site Action and chose Edit Page. Add the web parts listed in Table 1 to the page. To learn how to add web parts, see the Microsoft article," Add or remove Web Parts from a page" (http://office.microsoft.com/en-us/sharepointserver/HA011605831033.aspx). Figure 2 shows the site in its completed form.
4. To save the site as a template, enter the URL of your site, press enter, and wait for the site to load. Select Site Action, and chose Site Settings. Under Look and Feel, click Save Site as Template. On the Save Site as Template page, which Figure 3 shows, in the File Name section, enter TemplateSite. Then select the Include Content check box, and click OK. Note the site template name.
5. To use the template, enter the URL to the provision site (web page). Select Create a New Site. You’re then prompted to enter a Site Name, URL, and Description.
6. At the bottom of the page, you’re prompted for the site template. Here you have the option to select one of the Template SharePoint sites. Select the custom site template you created and continue answering the remaining prompts.
Site Definitions
A site definition, as mentioned earlier, is a group of configuration files that provide a framework for creating SharePoint sites with a certain structure and functionality. Each site definition is contained in its own folder in Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\SiteTemplates. The file that contains the site definition is onet.xml, which is located in a subfolder called \TEMPLATE\SiteTemplates\SMS\XML\ONET.XML. The following sections describe the key configuration files for site definitions and provide examples of how to create a definition and make simple edits to customize it.
Create a Definition
The first step is to create a definition you can work with by copying an existing site definition. To do so, open Windows Explorer and browse to Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\SiteTemplates. Create a folder called MYCUSTOMSITE. Copy the STS folder contents to the MYTEMPLATESITE.