Monday, October 8, 2012

Save Site as Template for Publishing Sites

Today we celebrated Nick's birthday while I was working on Content Types, Document Libraries and Publishing Site features on my Office 365 SharePoint 2010 Online version.

I thought that creating site templates will be a piece of cake for me and it will be much tastier than the one I just had. But as it turned out, and as Aurelien puts it "not a piece of cake".

I was trying to create a site template for Publishing Site in SharePoint 2010 and I realized that I cannot.

Ofcourse there is a workaround.

Once you have all the customizations you want to have, go to Site Actions > Site Settings

Click Manage site features under Site Actions 

and Deactivate SharePoint Server Publishing feature.

Clicking Deactivate will take you to Warning page, click Deactivate this feature. (Dont worry, you can always re-activate it again and no love is lost)

Go back to Site Settings page and now you will see Save site as template under Site Actions
Now save this site as a template by giving it a File Name, Template Name and options Template Description.

If you want to have the content that you uploaded in document libraries or items in lists part of your template so they can be used again, click Include Content check box. Click OK to save your site template.

Site Templates in SharePoint 2010 are not .STP files any more  Moreover they are not in Site Template Gallery like MOSS 2007. Site Templates are .WSP files stored in Solution Gallery like features and webparts.

As you have already created your site template, it is of no use until you activate this template. Click Site Actions> Site Settings again.

and click Solutions under Galleries

You will see your site template. If its not already activated, activate it. Go back to your original site and enable SharePoint Publishing feature again.

Create a new site by click Site Actions> New Site. Select Blank & Custom from Categories and select your hot,  freshly baked template straight from the oven. Set a Title and decide on a URL.
Click Create.


Aaaannnnnnnnd you are done. Wooow not so fast. Remember you deactivated Publishing Feature to create this site template and as this site is created from a deactivated publishing feature site template, you have to enable it to get publishing features.

This is a very good article which gives you an idea of what you get and what you are missing if you create a site from site template.