Winsmarts.com

Microsoft MVP

MVP Logo

Awarded the Microsoft MVP Award.

Hosted By

blah!bLaH!BLOG!!

All you ever wanted to know about SharePoint 2007 Site Templates

Posted on 7/5/2007 @ 5:17 PM in #Sharepoint | 11 comments | 10384 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?
AND
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?".

EASY!

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.


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??
Denise

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??
Denise

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!
More!!!!

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.

Please post your comments:


Your feedback will be submitted for moderation, and will appear after it is approved.

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 

Site designed and maintained by Sahil Malik | All Rights Reserved. ©2007 WinSmarts.com.