Save site as a template publishing site SharePoint 2013


We all know that SharePoint doesn’t support saving publishing sites as a template. I don’t recommend doing that anyway as the produced template will have errors and isn’t reliable to be used in production to create new sites off of. However, sometimes as a developer you need to save a publishing site as a template to see how SharePoint packages things. This can help you build your own custom web template which is a neat thing and replaces the need to save a publishing site as template.

Well, since the Save site as a template option is hidden from the publishing sites settings page we all used the following URL to go there directly:

/_layouts/savetmpl.aspx

Or

/_layouts/15/savetmpl.aspx

Well, that is not going to work anymore in SharePoint 2013 if your site is a publishing site or have the publishing features activated.

You basically get that following error:

The “Save site as template” action is not supported on this site.

ErrorSaveSiteAsTemplate

In order to get around this issue you need to update a single property page value in your SPWeb object for the site you are trying to save as a template and you are good to go. The property is called SaveSiteAsTemplateEnabled. We need to set that property to true that’s all.

I will show you how to do that using PowerShell:

# Get a reference to the target site

$web = Get-SPWeb http://Intranet.SWRanger.com/Publishing

# Update the property bage value and set it  to the string value “true”

$web.AllProperties[“SaveSiteAsTemplateEnabled”] = “true”

# Commit the property change to server

$web.Update()

PS_SaveAsTemplateChange

Very simple. Now if you navigate to the Save site as a template page using the URL directly it will show fine and it will allow you to save the site as a template which stores a copy in the Solution gallery of the site collection. Make sure you have enough space in your C drive temp folder because it uses that location as a staging directory.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s