Save publishing site as a template

Save your newly created SharePoint site as a template can save you a lot of time if you want to replicate it again in your environment.

Unfortunately if you used a Publishing Site or if you had to activate the Publishing Features in a Collaboration Site, save site as a template will not be available.

In this article I explain all the steps to bring back this feature to the publishing sites and also the extra steps you may need to activate all site features.

Save Site as Template - SharePoint

  1. Open the site with SharePoint Designer
  2. In the ribbon go to Site Options
  3. Locate the option SaveSiteAsTemplateEnabled and modify the value to true
  4. Since the site template is disabled in the Publishing sites the option Save Site as Template is not available in the Site Settings you will need to navigate to the page directly: http://yourdomain.sharepoint.com/_layouts/savetmpl.aspx
  5. Provide all the details and click OK after a couple of minutes you will have the WSP site template generated

    If the operation succeeds you will see the screen bellow

    Note: If you have apps downloaded from the store they could prevent you to save the site as a template if you are facing this scenario you will need to uninstall the apps first.

  6. Open the Solution Gallery and click in the template name to download the wsp file containing the site template


Create a site based on the new template


  1. Open the site collection where you want to install the site template. If you have other sandbox solutions installed in the original site collection you will need to install them first in the new site collection
  2. Open the Solution Gallery to upload and activate the site template wsp
  3. Go to Site Contents and create a new subsite
  4. Provide all the details and select Custom in the Select a Template option
  5. Select the template name and click Create, it may take a few minutes
    If the site creation fails, you will see an error message like this and you will need to activate the missing features.


Activate missing features

Most of the missing features can be activated in the Site Settings and to do that you have a graphical interface. If the required feature is not available in the features list, you can follow the steps bellow.

Office 365

You can activate features from SharePoint Online using a PowerShell script, the script and the required dll files can be downloaded from here.

  1. Extract the files from the zip
  2. Edit the PS1 file
  3. Modify the variables to connect to your SharePoint
    $sUserName: User Name to connect to the SharePoint Online Site Collection
    $sPassword: Password for the use
    $sSiteColUrl: SharePoint Online Site Collection
    $sFeatureGuid: GUID of the feature to be enabled
  4. Run the script
  5. After all features have been activated you will be able to create your custom site


SharePoint 2013 and SharePoint 2016

  1. On the SharePoint server open the command line as Administrator
  2. Type the following command cd C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\BIN”
  3. Type the following command stsadm -o activatefeature -id -url
  4. Replace the feature-guid by the feature ID, depending of your SharePoint version it can be presented as a correlation ID
    Replace the site-collection-url by the site collection url where you want to activate the feature

  5. After all features have been activated you will be able to create your custom site

9 Responses to “Save publishing site as a template”

  1. Norbert

    January 27, 2017

    I try using the savetmpl.aspx but as soon as the page opens it redirects to the home page of the site.

    Any tips?

    Reply
  2. DA Employee

    March 6, 2017

    This does not work if there are downloaded apps as you mentioned, and you suggested to uninstall them first. Uninstalling these apps may not be a SOUND suggestion. Have you tried it? Most of these apps were downloaded to be used in the site to begin with. Their removal deletes their instances, if not displaying error(s), in the site.

    Reply
    • João Ferreira

      March 7, 2017

      Hi,

      Yes I tried it, please notice that this is just a work around and may not work for all scenarios.
      What I do is uninstall the apps if necessary and then reinstall then in the new site.

      Reply
  3. Florian

    March 29, 2017

    This worked for me. Unfortunately the homepage (in my case default.aspx) is empty. It’s an article page with customized pagelayout. Is there a way to get a 1:1 copy of this page?

    Reply
    • João Ferreira

      March 29, 2017

      Hi Florian,

      Yes it’s possible you can follow this article to reapply the custom page layouts after the site creation.
      http://sharepoint.handsontek.net/2017/01/29/fix-publishing-pages-with-custom-page-layouts-created-from-template/

      Reply
      • Florian

        March 29, 2017

        Hi João,
        if I understand your post right. This will be only applicable _after_ the site is created with the custom site template, right? So there is now handy way to prevent this behaviour?

        Reply
        • João Ferreira

          March 29, 2017

          You understood it correctly the behaviour will not be preserved, it will always require a manual intervention to get the correct page layout to display.
          I have not found any other way to implement site templates with publishing sites, but there are new alternatives to this process.
          I never tested them so I don’t know if they will preserve the behaviour of the site, have a look at the links bellow:
          https://templates-gallery.sharepointpnp.com/
          https://github.com/SharePoint/PnP-Provisioning-Schema/wiki

          Reply
          • Florian

            April 12, 2017

            Hey João,

            it’s me again. 😉
            Your post blogs really helped me out. But there’s just one little thing which lets me bang my head against the desk: Applying my custom master page. It is allready available at sitecollection level but against the law af inheriting the newly (by template) created subsite just shows up with seattle.master. The configuration is just fine (so it will inherit master page, page layouts, etc.) but I have to go on sitecollection level and “deploy” the master page over all subsites again.
            I tried this: http://jeffreypaarhuis.com/2011/10/21/your-master-page-automatically-on-newly-created-subsites/ combined with https://blogs.msdn.microsoft.com/bgeoffro/2009/06/22/master-pages-revisited-references-to-master-pages-in-sharepoint/ so the ONET.xml configuration looks like this:

            I don’t call for support, but maybe you have a hint for me, where to look for more information?!

          • João Ferreira

            April 13, 2017

            Hey Florian,

            Never experienced this before as long as the master page is deployed in the root site of the site collection all the sub sites created from template or not should inherit them.
            If you have installed the custom master using a wsp also make sure that the solution is active.
            Check with SP designer if the master pages are located under All Files -> _catalogs -> masterpage, if you have the masters check them out, check them in again and publish as major version.
            Let me know if you discovered the cause of the issue.

Leave a Reply


Web developer focused on SharePoint branding, blogger, tech enthusiast. Traveling and sports are my addictions, knowledge and success are my daily motivations.