SharePoint 2010: Site Definition Vs Web Template

Site Definition and Web Template are used for building a SharePoint site. If you are new to SharePoint, you may wonder which one to use?. Well, it depends on your site requirements and extensibility. Both are used to build a site UI interface to the end user.  The major difference is a Web template is always based on a existing Site Definition either directly or indirectly. I have outlined some comparisons in the below table

 

Site Definition

Web Template

core definition in SharePoint Based on existing Site Definition either directly or indirectly
Stored on a Front-end Web Server in folder

%ProgramFiles%Common FilesMicrosoft Sharedweb server extensions14TEMPLATESiteTemplates

Stored as a .wsp file in SharePoint Database.
Complex to create Easier to create
Deployed as Farm solutions with Admin rights Deployed in Solution Gallery(Sandbox)
Once def, cannot be modified can be modified without affecting existing sites
Configurations are defined in WebTemp*.xml and ONET.xml
WebTemp*.xml file contains one or more Template elements which represents a Site Definition
Details of each Template element in WebTemp*.xml are stored in a corresponding Configuration element in the ONET.xml file.
Configurations are defined in a xml and ONET.xml(part of .wsp file).

In the XML, The only difference is WebTemplate element instead of Template as defined in WebTemp*.xml.

The ONET.xml is simpler than that of Site Definition ONET.xml.

 

Note:

1) Sites created from a Site Definition or Sites created from a Web Template (that is based on the Site Definition) may not work properly if modified or removed. New sites based on Site Definition cannot be created. 

2) Out of Site Definition and Web Template, Web Template is easier to create ,maintain, modify and deploy. A Site definition is preferred, when you need custom components(defined in ONET.xml) and email footers,.

3) If you go for a Site Definition, the best practice is to have a minimal Site Definition to be acted as model and extend it with using Site Features whenever required.

Leave a Reply

Your email address will not be published. Required fields are marked *