All you ever wanted to know about SharePoint 2007 Site Templates

Posted on 7/5/2007 @ 5:17 PM in #SharePoint by | Feedback | 30851 views

What are site templates?

Sometimes, you need to create the cutter for sites, so you can create cookie cutter sites easily. SharePoint comes with a few such cookie cutters out of the box. You might have seen this cookie cutter picker when creating a site/site collection etc. as shown below:

Those are usually site definitions (not Site Templates). I have covered the process of registering custom site definitions over here.

The obvious Q here is, How are Site Templates different from Site Definitions?

Site Templates vs. Site Definitions

  1. Site Templates are a LOT easier to create than Site Definitions. You can create a site template using point and click. Creating a site definition requires hand-coding a lot of XML files and other supporting files.
  2. Site templates serve a customized version of pages, i.e. low performance. Site definitions serve uncustomized pages, i.e. high performance. Thus you should choose site definitions over site templates, if a large number of sites will be created based on this cookie cutter.
  3. It is fairly easy to move around a site template. It is a tad bit (but not horribly more) complex to move around site definitions.

How to export a site to a site template?

Pretty darned easy. Go to http://<yoursiteaddress>/_layouts/savetmpl.aspx . Note: There is no  UI point and click that takes you to this URL for a site, so note this URL down.

You are presented with the following form.



Fill it out, and hit "OK". The template file (.stp) gets saved under the Site Template Gallery, which can be accessed by going to the Site Collection, Site Actions --> Site  Settings --> Modify All Site Settings, and clicking on the "Site Templates" link under the "Galleries" section. As you can see, the entire site got squeezed into a single .stp file (which is really a cab file). Quite impressive. :-)

How to register a site template inside a site?
How to restrict certain sites to use only certain site templates?

Okay, so now you have created a cookie cutter for your site. The next obvious question is, "How can I use this cookie cutter?".


a) You need to make sure that the site template exists on the site collection. This can be done by uploading an existing site template to the site template gallery. As mentioned above, the site template gallery can be found by going to the top level site in the site collection, then going to Site Actions --> Site  Settings --> Modify All Site Settings, and clicking on the "Site Templates" link under the "Galleries" section. Alternatively, you may also use the stsadm -o addtemplate command.

b) The next step is that you need to make this template uploaded in the gallery available to individual sites. So that is basically saying that Site A can use template X, but Site http://A/B can use only template Y. You would note for instance that out of the box, a publishing site lets you choose only "Publishing site with workflow" definition based sites as child sies. Well you can change that.

1. Just go to http://<yoursiteurl>/_Layouts/AreaTemplateSettings.aspx NOTE: Note down this URL :-), there is no point and click way of getting to at the site level. At a site collection level, you may use Site Settings -> Modify all Site Settings -> Page Layouts and Site Templates to reach the same page.

2. Pick the templates you'd rather have available as shown below:

.. and hit "OK". Now the appropriate site templates will show up in the cookie-cutter-picker. :-) w00t! 

Ummm .. thats about it as far as site templates go. Anything I missed re: Site Templates? Leave a comment or send me a message.

Sound off but keep it civil:

Older comments..

On 11/14/2007 3:11:46 PM Denise said ..
Hi there!

do you know of any reason why you should not create a site template from a "Publishing" site??


On 11/14/2007 3:17:54 PM Denise said ..
Hi there!

do you know of any reason why you should not create a site template from a "Publishing" site??


On 2/2/2008 10:56:56 PM Anonymous said ..
Where did you find some of that obscure information?

I particularly liked the AreaTemplateSettings.aspx tip!


On 5/20/2008 10:30:15 AM Wassini said ..
Nice info, but I need information about why som templates does not allow the creation of subsites...

On 7/13/2008 4:20:48 AM Orna said ..
Is there a way to change a site template, so that all the sites created from it would be effected by the change?

On 7/18/2008 9:13:26 AM Dave said ..
interesting, but doesn't keep up with the title.

On 8/29/2008 4:23:49 PM Jason said ..
You can also perform all these functionsn in Office SharePoint Designer using Import/Export under the File menu...

On 9/1/2008 4:37:57 AM Gerard said ..
cool. i have a very interesting question, how can i create a site with 3 columns on the master page and save it as a template

On 9/29/2008 7:50:44 AM anders said ..
Damn - really nice solution - saved me many houers - thx

On 11/12/2008 10:17:08 AM NHandberry said ..
Is the page _Layouts/AreaTemplateSettings.aspx only available for MOSS or for WSS 3.0 as well? I get an unknown error when entering the url and if I go to Site Settings -> Modify all Site Settings -> the page is different. It's just called Site Templates and in the view it says it doesn't show default templates which are the main ones I'm trying to restrict.

On 12/1/2008 12:44:45 AM Rock said ..
i have a template file.i need to apply it to create sub-site in the existing site.

i am not able to see the template when i upload it to site templates.

can anyone help me.

On 2/24/2009 10:17:38 AM flaurin said ..
The AreaTemplateSettings.aspx tip is awesome!

On 3/3/2009 10:36:45 AM Tony said ..
Be careful following these instructions. What the original poster said is not 100% accurate, and following these steps will result in an environemnt that is not supported by Microsoft.

All of the above pages ARE accessible by the web UI, WHEN IT IS SAFE TO BE USED. The "Save Site as Template" link is only visible within Site Settings page when the site is not a Publishing site. All publishing sites have that specific action disabled because saving a Publishing site as a site template causes inherent errors that get carried along to the sites created from that template. Sometimes the pages are no longer recognized as publishing pages and lose their attachment to page layout templates. Other times, those newly created sites fail when being saved as a site template themselves. Basically, the Publishing Feature that is turned on for publising sites causes minor internal conflicts within the site structure that, although may not be apparent at first, will potentially cause major problems to your sites in the future.

The AreaTemplateSettings.aspx is also avaialble from the UI, but only if the site at the site-collection level is a Puglishing site. Since page layout templates are only available with Publishing sites, this menu option is only avaiable from sites with the publishing feature turned on.

Hope that clarifies some things for all of you.



On 3/3/2009 10:48:05 AM Tony Ko said ..
Almost forgot...a few more of the biggest difference between Site Definitions and Site Templates are their physical locations, and their relationship with the sites created from them:

Site Definition files reside within the 12 hive folder structures of the web front end servers, while Site Templates reside within the content database of the web application. In an environment where your sharepoint farm have multiple servers, the choice of using Site Definition or Site Template will also dramatically effect performance. Since site definition files are all locally stored on the front end servers, sites that are derived from site definitions have a much faster load time. In comparison, since site templates are stored within the content database, sites that are derived from site templates must make database calls to load the site, which can result in a much slower load time depending on the throughput of your back end SQL server.

With regards to the relationship of the sites that are created from site definitions and site templates, all sites created from site definitions run more efficient because they always reference the definition for the "base image" of the site, such as default web parts, page layout and zones, etc. Only items that are different than the base image are stored in the content database. However, sites created from site templates are just a copy of the template. Once it is created, it no longer references the template for anything and loses all relationship with the template. So, if you're creating a lot of sites with the possibility of needing to make a common change throughout all the sites in the future, your best choice would be to create a site definition, because anything you change in the definition would reflect throughout all the sites that are created from that definition. Whereas any changes you make to a site template will not have any effect whatsoever to any sites already created from that template.


On 3/19/2009 11:32:32 AM Glenn said ..
I just took over a sharepoint farm and all sites that are creatsd in any manged path

have under: Look and Feel

Title, description, and icon

Tree view

Site theme

Top link bar

Page layouts and Site Templates

Welcome page

Master Page

Quick Launch

Save site as template

Reset to site definition

Publishing is not enabled on the sites, any ideas as to why this might be?

On 1/11/2010 5:18:46 PM James said ..
Its a good information. I have used above & works fine when we create the site from browser. But if we create the site using SharePoint web service, I have used createDWS operation and it uses the default template instead of selected one. I am using SharePoint 2007.

Anyone has any clue on how to apply this restriction to web service created sites or is there way to change the default template.

On 3/4/2010 2:04:52 AM Jordon said ..
Thank you so much. It was so easy to understand and implement.

I would be also interested in doing same in Sharepoint 2010. Any idea??

On 12/27/2010 11:36:59 AM Sofia Khwaja said ..
Excellent article! Thanks very much for the tips. This is exactly what I was looking for.

On 4/3/2011 9:37:45 PM Keith Rowley said ..
OK, I've got my site template file (the .stp file) in my Site Tempates Gallery... now what? How do I now APPLY that template to my site?

On 5/25/2011 8:24:11 AM Esme said ..
Excellent article!

This is exactly what I was looking for.

On 8/23/2011 9:37:31 AM cecil said ..
My name is Cecil and I am sending you this email in search of finding a solution on how I can Copy / move a template from one SharePoint Site to another SharePoint site

And the copying / moving files, folders and subfolders from one SharePoint Site to another. Can this be done? I am currently working at the S1 Innovation center where we are creating SharePoint sites and one task is copy all that we have (Templates, folders. Files and sub-folders) from one SharePoint Site to another but I find that it is not as easy as the research material I am finding states.

I really appreciate any feedback you might have on this topic.

On 2/23/2012 10:29:18 AM Juan Arena said ..
Hi all! I got one question, I need to make some changes to my Site in the Sharepoint of my company, My question is: Can I change without any risk the template of my site, the information inside will be lost or is safe?