SharePoint: Site Templates, Site Definitions and Themes Explained

SharePoint uses site definitions, site templates and themes for customization. While there are similarities in each, they are all very different and very powerful in their own right. Understanding each of these is key to customizing SharePoint.

SharePoint Themes

Difficult Level: Easy/Moderate

SharePoint themes are a collection of stylesheets and images which basically skin a site. While they do not control the layout they can be edited to customize the look and feel of a sites fonts, background colours, borders, links etc.

For example: If you wanted to change the border around a web part, or the title bar of a web part you would customize it via the theme.

By default there are several global stylesheets applied to all sites. This is true for both SharePoint Portal Server 2003 and Windows SharePoint Services. (Example: OWS.CSS, MENU.CSS and in Portal Server’s case SPS.CSS).

The global stylesheets are stored on the server in the following location
C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\LAYOUTS\1033\STYLES

The rule of thumb is stay away from these files because if you change them every site created from there on out will have that customization.

Best practices would suggest that If you want to skin your site you should create your own theme which can then modify and apply.

Themes are stored on the server in the following location:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\THEMES

The master list of all themes available (SPTHEMES.XML) is located on the server in the following location:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\LAYOUTS\1033

The readers digest version of Theme creation and setup;
1) Duplicate an existing theme,
2) Add the theme to the SPTHEMES.XML file
3) Customize the classes in your new theme as desired
4) Apply the theme (via site settings – http://YOUR-SERVER/_layouts/1033/themeweb.aspx)

When customizing themes it is not always easy to know what class/id is applied to what element. Fortunately there are several javascripts available to help you; Todd Bleeker has a nice one freely available, you can download Todd Bleekers Style Finder here.

SharePoint Site Templates
Difficulty Level: Moderate

Site templates are an easy way to archive your entire site into a single file. This includes all pages, lists, libraries and contents.

A site template can have one of two possible extensions depending on how you created it, these two types are also very unique.

If you created your template from the browser it will have an STP extension and if you created it via FrontPage 2003′s backup it will have a .FWP extension.

Site templates created via the browser (.STP) are useful for users that make modifications to a site by creating custom content elements (doc libs and lists) and want to use that as a benchmark for all future sites. When used this way they are not unghosted.

Site template created via FrontPage 2003 (.FWP) however are extreme customizations and are meant to be unique and independent of the portal. FrontPage 2003 site templates are not controlled by a master definition which is the default for all SharePoint sites. If you create this type site template, the site is from there on out on it’s own.

This is commonly referred to as “unghosted”. This has been a major issue for people wishing to customize their SharePoint sites via FrontPage 2003. This issue is being addressed in the next version of SharePoint.

A site template by default is not available globally on the server the way a site definition is so if you have a template you do not want applied by anyone else this may be a good alternative. You can however make it available globally by placing it in the site template gallery.

Once you have created a SharePoint site you can wrap it up into a site template which is still ghosted from your browser by visiting:

http://YOUR-SERVER/_layouts/1033/webadmin.aspx

Alternatively you can do extreme customizations via FrontPage 2003 and then create an unghosted site template by using the Tools -> Server -> Backup WebSite

If you are intereseted in learning more about creating SharePoint sites with extreme customizations and wrapping them into site templates you can view my on-going WSS site creation tutorial.

Another great reference to help you better understand these is the MSDN article, an Introduction to Site Templates and definitions.

SharePoint Site Definitions

Difficulty Level: Advanced

Site Definitions are the master templates behind SharePoint sites. Site definitions are used to optimize performance within SharePoint. The way it optimizes performance is it uses a single set of files to create every site based on that definition. This minimizes the need to duplicate files and is commonly referred to as “Ghosted”.

By default when you create a site you are asked to pick a template, this template is actually the site definition for that type of site. There are several types of definitions (Blank Site, Team Site, Meeting Workspace etc).

Site definitions are a very powerful way of creating a fully customized (site definition) which can be applied to any new sites from there on out. While it is a template, it is not an unghosted template.

For Example:If you created 1000 sites based on a single customized site definition and the logo you added changes, you just update a single .aspx file with the new logo and all sites will reflect the changes. The opposite would be said for site templates. If you have 1000 site templates, they would all have to be updated individually.

The beauty of this method is that the site definition controls “all” sites using it. Think of it the way CSS works only at a larger scale. You can control 1000 sites all from a single set of files.

Site definitions are created much the same way themes are, you duplicate an existing one, add a reference to a master list and then modify it accordinly. Site definitions require an IIS reset to show up in your list.

Site Definitions are stored on the server in the following location:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033

The master list of site definitions is called the WEBTEMP.XML file. Unlike theme setup however you do not edit this master reference file, instead you make a copy of it, it later gets appended to the main WEBTEMP file.

For example: If you duplicated a site definition and renamed it to TEST, you would also duplicate the WEBTEMP.XML file and call it WEBTEMPTEST.XML

Inside the WEBTEMP file you would modify the settings you want to reflect the name of your site definition. You can also remove any extra references that are un-needed.

The WEBTEMP file is located on the server in the following location:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\XML

Each site definition contains an XML directory. Inside this directory there is an ONET.XML file. This file is of extreme importance as it controls the configuration of your definition. The ONET tells the definition what lists should be available, what columns/fields should be in the list, and things of that nature. You should be very careful when editing this file.


There are several great tutorials online for creating site definitions. I would recommend the following:

Heather Solomon’s Site Definition Primer

Heather Solomons Site Definition Reference

Supported and Unsupported Scenarios

Site Definitions – What they are, and why you need them (on DEV X)

Site Definitions – Google Search

This entry was posted in SharePoint. Bookmark the permalink.

4 Responses to SharePoint: Site Templates, Site Definitions and Themes Explained

  1. Daniel says:

    You rule man! Thanks for your great effort and work. Keep it up :) Very nice tutorials and quite easy to understand.

  2. Anonymous says:

    Thank you! You helped a lot to get an overview.

  3. Dennis says:

    Nice summary man! thanks!

  4. Great post and superb information. Keep up the good work. Much appreciated including your help on the MS newsgroups.