次の方法で共有


Site Definitions versus Site Templates and deciding on the correct customization approach

Site Definitions

l A site definition is the core definition of what a site is in SharePoint.

l A site definition is installed on file system of web front ends, located at ..\12\Template\SiteTemplates. This directory is language-neutral.

l A site definition consists of .aspx pages and .xml files with Collaborative Application Mark-up Language (CAML).

l A major benefit is that the Page and List definition is read locally from the file system, not from Content Database.

l A site definition Page and List definition are cached at IIS process startup

l Customizations made to site definition are stored in content database, not on the file system. This can be performed via SharePoint Designer, or when custom site templates are saved.

l are developer created

l Localization: WSS 3.0 supports full site template localization (based on ASP.Net 2.0 via XML files and .ASPX files pulling strings from RESX files. Therefore solutions can be shipped “language packs” of resource files.

l “Global Template” defines commonality across site definitions; it gets called before any other template. It works by injecting common provisioning content into all new sites. ONET.XML file defines base types, galleries, mobile redirects

 

Site definitions

· Site Definitions and Configurations - https://msdn2.microsoft.com/en-us/library/aa978512.aspx

· CAML - https://msdn2.microsoft.com/en-us/library/ms462365.aspx

Site Template

A site template (*.stp file) is created through the user interface or through implementation of the object model. It is a package containing a set of differences and changes from a base site definition.

 

The site template package is stored as a CAB-based file that can be downloaded or uploaded to site collections by users with the appropriate rights. As before, site templates offer a measure of portability to SharePoint Applications.

 

It is not as performant as a pure site definition as site definitions are cached on start of IIS on the web front ends while site templates are stored and hence need to be fetched from the content database and merged with the site definition code at runtime to render the site.

 

Also note that if you plan to transfer a site template to separate farm, that the farms have the same versions installed of SharePoint installed.  (hotfixes,etc.) This is due to the dependence site templates have on the original base site definition they were created from.

 

Deciding Between Site Definitions and Custom Site Templates

See : https://msdn2.microsoft.com/en-us/library/aa979683.aspx

 

When choosing whether to create a site template or a site definition, first consider the following issues:

· Are the changes you need to make simple or complex? If, for example, you need to make only minor changes in the look of certain pages and add a few fields in particular lists, you should create a custom site template. However, if you need to create new content types, add new Web Part definitions, and significantly restructure sites, you should create a custom site definition.

· Can you deploy changes to the front-end Web server? If you do not have access to the file system of the computers running Windows SharePoint Services, you have no choice but to create a custom site template.

 

Custom site definitions hold the following advantages over custom templates:

· Data is stored directly on the Web servers, so performance is typically better.

· A higher level of list customization is possible through direct editing of a Schema.xml file.

· Certain kinds of customization to sites or lists require use of site definitions, such as introducing new file types, defining view styles, or modifying the Edit menu.

 

Site definition disadvantages include the following:

· Customization of site definition requires more effort than creating custom templates.

· Editing a site definition after it has been deployed is difficult.

· Doing anything other than adding code can break existing sites.

· Users cannot apply a SharePoint theme through a site definition.

· Users cannot create two lists of the same type with different default content.

· Customizing site definitions requires access to the file system of the front-end Web server.

 

Custom templates hold the following advantages over customization of site definitions:

· Custom templates are easy to create.

· Almost anything that can be done in the user interface can be preserved in the template.

· Custom templates can be modified without affecting existing sites that have been created from the templates.

· Custom templates are easy to deploy.

 

Custom template disadvantages include the following:

· Custom templates are not created in a development environment.

· Custom templates are less efficient in large-scale environments.

· If the site definition on which the custom template is based does not exist on the front-end server or servers, the custom template does not work.

Comments

  • Anonymous
    July 13, 2008
    PingBack from http://blog.a-foton.ru/2008/07/site-definitions-versus-site-templates-and-deciding-on-the-correct-customization-approach/

  • Anonymous
    July 21, 2008
    HiYou can create custom templates in development . You need to deploy them see example of how to deploy a list template hereYou can also do the same for site templateshttp://www.sharepointblogs.com/tonstegeman/archive/2007/07/10/deploy-a-sharepoint-list-template-to-sharepoint-mysites.aspx

  • Anonymous
    May 07, 2009
    Excellent Article ...Hats-off.. Looking forward to more articles like this from you in future

  • Anonymous
    August 18, 2009
    The comment has been removed

  • Anonymous
    September 21, 2009
    Very nice post, however a few comments:I agree with you that site definition are harder to develop but I do not agree that it is difficult to change after it has been deployed. I say this mainly thinking at feature stapling (I have seen on the MS site that changing site definitions already in use is not supported fo feature stapling is the only solution left :)).I always leave the onet.xml file blank and I only set the list of site/web features to be activated by default. By doing this I have never seen the issue you mentioned about 2 lists of the same type (I have never tried using SharePoint themes directly in the site definition, but I think it should be possible).Also, 3 important points about site definitions/templates comparison :site templates cannot be multilingual you cannot create a site template from a publising site (actually it works, if you use the correct Url but I think it is not supported, the link to create a site template is removed in the site admin page) you cannot create a site template for the root site of a site collection (at least I haven't found a way to do it) using site templates require extra work when working with multiple site collection/web application (you have to manually/automatically deploy the .stp files in the gallery)

  • Anonymous
    April 11, 2012
    Excellent Post..This is what I was looking for.. Thanks

  • Anonymous
    February 04, 2014
    Recently I was in need to create a live running SharePoint template site that was supposed to be a site template for any future site collections creations.Hence it was a multi-site collection environment. So after setting up this Live Template for site. I created a custom web part that is creating site collection and reading the template file from solution gallery of site template and then doing any other operations need via code.My client finds it an awesome solution and praise for it. Initially it was planned to develop a Site Definition with time estimate of 200hrs.Using this live template saved a lots of time and effort.I am also planning to codeplex this site collection provisioning using live site templates.BRfaisalStockholm

  • Anonymous
    February 04, 2014
    Recently I was in need to create a live running SharePoint template site that was supposed to be a site template for any future site collections creations.Hence it was a multi-site collection environment. So after setting up this Live Template for site. I created a custom web part that is creating site collection and reading the template file from solution gallery of site template and then doing any other operations need via code.My client finds it an awesome solution and praise for it. Initially it was planned to develop a Site Definition with time estimate of 200hrs.Using this live template saved a lots of time and effort.I am also planning to codeplex this site collection provisioning using live site templates.;)

  • Anonymous
    July 17, 2014
    @faisal: what do you mean with "live template" or "live site template" ? I have a similar challenge :) Best regards Dominik