Creating site collection templates

[I’ve been meaning to update this post for quite sometime. Please don’t do this procedure even though it was documented in MSDN. If you do this when you create a site from this site template a lot of the functionality will be broken, eg workflows etc.  The only proper way to create your own site templates to create site collections from is by using custom site definitions (or copying and modifying an existing site definition).]

This guide shows how to create a site collection template that will appear on the create site collection screen from central admin or from the create site page if self-service site management is enabled.

  1. First create a site collection based on what ever template that you would like to start with for example the Collaboration / Team Site template. Customise the template to what you would like. For example create additional document libraries and set versioning.
  2. From the site settings, Look and Feel , Save site as template. Give it a file name, template name and description. Optionally choose if you would like any content that you have added to the template to be included.
  3. Once this is done it will create the template.stp in the site template gallery. Browse to this gallery and download the file. Once you have this file copy it to your sharepoint server. Also if you are going to re-use the template you might want to delete the template from the gallery and then delete it from both recycle bins in the site collection recycle bin.
  4. To add the template to central administration site templates you will need to use stsadm. I recommend that you add the path to the bin directory containing stsadm.exe to the system environment variables.

C:\source\site-templates>stsadm -o addtemplate -filename “project-simple.stp” -title “Project site – simple” -description “Project site template with a simple structure”

Operation completed successfully.

IIS must be restarted before this change will take effect. To restart IIS, opena command prompt window and type iisreset.

Deleting a template from the command line. Below is a code snipet of how to list the templates installed and then how to delete the template based on its title.

C:\source\site-templates>stsadm -o enumtemplates

IT Project Site – Language: 1033 – Site Template: _GLOBAL_#0 – Template Id: 1

C:\source\site-templates>stsadm -o deletetemplate -title “IT Project Site”

Operation completed successfully.

IIS must be restarted before this change will take effect. To restart IIS, open
a command prompt window and type iisreset.

C:\source\site-templates>

Posted in howto, sharepoint
18 comments on “Creating site collection templates
  1. […] underneath managed paths we are trying to use a custom site template. (I have previously posted the procedure I use to create and load a […]

  2. khaled says:

    i want to ask about smthing , i create a new application pool and then i created new web application, then i created new site collection and i gave it name, but when i click on the url , the page is empty and nothing in it,what can i do?

  3. rick says:

    hi… question…. i have created a site collection that has a top site and a few subsites… how do i save the entire site collection as a template?
    thanks,
    rick

  4. […] from Gavin’s: This guide shows how to create a site collection template that will appear on the create site […]

  5. Tim says:

    I have followed the instructions however I get an error when starting the new site collection indicating that “This page is not using a valid page layout. To correct the problem, edit page settings and select a valid page layout.”

    Can you please help.

    Thank you.

    Tim

  6. Moliway says:

    Hi, I want to know how to make a site coleection template (with subsites). I’m using Portal Template and in the configuration dosn’t appear Save this site as template

  7. Amy says:

    I am having a similar problem with site collections created from a template and was wondering if anyone else is having this problem… After creating a new site collection from my template, I go to “Edit Page” and “Add a web part” and the “All Web Parts” section is empty, preventing me from adding the common default web parts to teh page.

  8. gavinadams says:

    Hi Amy.
    You might be running into a bug.
    Checkout the post-sp1 rollup hotfixes.
    http://blogs.msdn.com/sharepoint/archive/2008/02/27/should-i-install-sp1-what-if-i-was-told-to-wait-post-sp1-rollup-and-black-out-rollup-now-available.aspx

    Included in the wss rollup is a hotfix for the following. http://support.microsoft.com/kb/942369/
    This might be related to the problem that you are having.

  9. gavinadams says:

    Hi Moliway,
    you cannot use these custom site templates to create subsites. They are also not designed to work with sites that have the publishing features enabled.

    To do what you are after you will need to create a custom site definition. Talk to your developer on how to do that.

  10. Amy says:

    Thanks for the responses! I REALLY appreciate the help. I guess there is a lot to consider. I have been a little nervous about installing SP1, so we do not have it yet. Also it looks like the hotfixes have caused some people new problems…
    I wish SharePoint was as easy as it is supposed to be!!!!! It seems for every new feature I try to use I end up with more and more problems.

  11. Jo says:

    Hi I have a question, when creating a Site Collection Template to be visible in central admin with the stsadm. Do all content types most importantly for me come across to new site collections with the saved template. I understand that document libraries, content and versioning comes across. But does all Content Types come across?
    Thanks

  12. John Caddell says:

    Gavin, I read this thread and I have a couple of questions. If I create a site template, it seems it is local to the site collection I create the site in. If I have multiple site collections, is there a way to use the site template across those site collections without having to copy it to each …/_catalogs/wt/ folder?
    Do I read correctly that there is a way to create a custom site definition that provides me with a template to create a site with subsites?
    Thanks,
    JBC
    National Semiconductor

  13. Lee says:

    This worked but the content types were not copied over. The libraries that had content types enabled got a list content type with a parent of document rather than a parent of a site content type. Any way around this?

  14. Ankit Goel says:

    Hi,
    When I run this command..I get command line error.However everything is same as specified in the article.

  15. Anuj Pant says:

    Hi,
    If you provision new sites using site templates you will run into the following issues
    1. Using a site template created from a publishing site is unsupported( you can still create the template by manually typing _layouts/savetmpl.aspx)
    2. Any content types will not be copied over. Content Types are not part of the site templates.
    3. Site template will not include any new features that were installed on the source server and used in the site.

  16. Ed says:

    The title of this article is “Creating site collection templates” and therefore led me to believe that I could create a template from my site collection.
    However, saving a site as a template does NOT include sub-sites, so I fail to understand why this article is so titled? It is not possible to create a ‘site collection template’ as far as I can determine.

    I wish to move a site collection to a new server in a different domain. If you have any other advice on this please do let me know.

    Thanks in advance
    Ed

  17. David G says:

    Glad I read the responses as there are many ‘got-yas’ with attempting to create a site collection from a custom template. Given these issues I think for me it will be better to create the new site collection from the standard templates, then save our subsite as a template(w/content), and then create a new subsite from this saved template within the new site collection.

  18. bhagwant says:

    How can we add Custom site templates in sharepoint 2010 ?

Comments are closed.