Share via


Save SharePoint 2013 publishing site as a template

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.

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 https://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()

 

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.

Comments

  • Anonymous
    July 23, 2013
    Great! Thank you for sharing,.

  • Anonymous
    August 02, 2013
    Thanks for the info. I was able to save the publishing site as a template using the above steps. But when I try to create a new site I am getting and error - "Exception attempting to ApplyWebTemplate to SPWeb". Appreciate your help. Thanks

  • Anonymous
    September 22, 2013
    There is another easy way to modify value for "SaveSiteAsTemplateEnabled" using SharePoint Designer 2013. See my detailed post on how to do this using Site Options in designer. www.learningsharepoint.com/.../missing-save-site-as-template-for-publishing-sites-in-sharepoint-2013

  • Anonymous
    October 31, 2013
    Thanks, very thanks this save me.

  • Anonymous
    November 22, 2013
    Same can be done using SharePoint Designer, Select site Root and on Ribbon select Site Options >> Select Parameter Tab >> Select "SaveSiteAsTemplateEnabled" click on modify button and change value from false to true.

  • Anonymous
    December 21, 2013
    I could save publishing site as template using recommendations from this blog. However when I try to create new site using that template the action is failing with page not found error. It is not creating pages in pages library. The log file generates lots of errors with message: UserAgent not available, file operations may not be optimized.

  • Anonymous
    April 15, 2014
    Thanks!

  • Anonymous
    July 07, 2014
    This is not supported, right? support.microsoft.com/.../2492356

  • Anonymous
    July 07, 2014
    sorry one more link: blogs.technet.com/.../save-site-as-template-option-and-the-publishing-feature.aspx

  • Anonymous
    July 08, 2014
    Though I changed the property of Savesitetemplateas to true. nothing is changing. Save as Template icon is still disabled. Can anyone help me out? Thanks.. and this is a public website in office 365

  • Anonymous
    July 08, 2014
    @BlueSky2010 --> Yes its not supported .. So I wouldn't do this in production not UAT for instance. But it will help you if you are developing a custom web template and want to see how sites are packaged, so you can do it in a dev server ...etc.

  • Anonymous
    July 08, 2014
    @Priya --> How did you change the property for the online site? Did you use client object model? Can you share your code?

  • Anonymous
    October 19, 2014
    Its working without any issue. Nice thanks for the information sharing.

  • Anonymous
    November 11, 2014
    Maybe it's an old post but i did the following process to create the site template:  

  1. Deactivate the publishing feature from the site, not from the site collection.
  2. Follow the steps in this post
  3. use the template in any site collection. I have done this and i have been create site collections and sites with the created site template with no issues, even when it's a different site collection. Thanks.
  • Anonymous
    July 09, 2015
    ahsan ranjha getting error on save as template publishing site UserAgent not available, file operations may not be optimized.

  • Anonymous
    November 24, 2015
    You can also do this another way if you are not too keen on using Powershell Open the publishing site in SharePoint Designer On the ribbon open 'site options' scroll down to - SaveSiteAsTemplateEnabled, click modify remove false then type true Click ok

  • Anonymous
    November 24, 2015
    @Jamie Great idea. Thanks