How do I save a publishing site as a template?
Shai Petel, VP R&D, KWizCom Corporation
You may have noticed that the “Save site as template menu” under “Look and Feel” site settings category is missing. This brings one to ask:
How do I get it back? And more importantly: Why was it removed?
In the following article I will answer these questions and give you tools to address this issue on your own.
In WSS sites, when you go to site settings page, this is how your “Look and Feel” category looks:
Notice you have the “Save site as template” menu option there.
It is important to understand that everything in SharePoint 2007 is based on features. So – you would be correct to assume this menu option is also a feature:
Feature folder: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\SiteSettings
Feature file: SiteSettings.xml
When you create a publishing portal site (internet facing or intra net collaboration portal) you will notice that among other changes, the “Look and Feel” site settings category has changed, a lot:
Notice, there is no longer the option to "save site as template".
So, keeping in mind that everything in SharePoint is controlled by features – think of a publishing site as a normal WSS sites that had some features activated in it (*this is not 100% accurate, but as it simplifies things we will say so, for the sake of the example).
Looking further in our Feature folder, you will easily find several feature folders that belong to the publishing site. One of these features calls you to hide the save as template menu from the site settings:
Feature folder: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\Publishing
Feature file: PublishingSiteSettings.xml
Notice the use of the HideCustomAction tag, with the corresponding HideActionld “SaveAsTemplate”.
Why is the “Save site as template” menu option removed from publishing sites?
Many of my customers use publishing sites. A lot of them tried to use the save as template option (some using code, some using a feature like the one below) and we all came to the same conclusion:
Since publishing sites have pages in them and layouts that are all connected to a content type that is configured at the top level site of the site collection, and because these content types are not saved and moved within the site template STP file – the STP file not, as one would expect it to be, a true reflection of the original site.
This means that if you save a publishing site as template and use it in the same site collection, providing all site content types it uses remain unchanged, the site template will work properly.
The problem arises when you try to move the site template to a different site collection, or when you've changed or deleted some content types in your current site collection – this will result in unexpected behaviour (that from my experience is irritating but fixable, with some work).
So, if you want to use the site templates within the same site collection, or if you use only the out of the box content types (welcome and article) with no changes, you should have no difficulties.
How do I add the “Save site as template” option back to publishing sites?
Here is what you need to do to add this option back to your publishing site. It's very simple; it will take approximately five minutes of work!
Simply create, install and activate a feature that will bring this menu option back to life!
Create a feature that re-register a “save as template” action to site settings. I said 5 minutes, right? So here is a feature ready to use - http://www.kwizcom.com/DownloadFile.asp?Id=1164 (it's my free gift to you!)
Save the folder inside the ZIP file, under your server’s features folder.
Run STSADM command:
“C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm” -o installfeature -name AddSaveTemplateToPublishingSiteSettings –force
After installation, you should have this new site collection feature:
If you did everything correctly, your new publishing site settings “Look and Feel” section will appear like this:
You will now be able to "save site as template". Easy, huh?!
* There may be other side effects of saving a publishing site as template. This article is for the community information benefit only and will not hold KWizCom responsible to any issues caused by this. It is strongly recommended you test on a pre production environment before you use this tip in a production server.