Back

TechnologyMay 05, 2014

SharePoint: How to Use a Site With Publishing Turned on as a Template

Will Stokes

SharePoint allows you to create a site, save it as a template, and use that template to create new sites, but this is not an option if you have publishing turned on at a site level.  You will find the “Save site as template” option is missing from the Site Actions section of the Site Settings page.

There are options to work around this that require using Visual Studio to create a solution and clean up the configuration files, but there is an easier option that will allow system administrators to easily, and quickly, use any site collection as a site template.

Our solution will backup the customized site collection template and restore the site collection to any number of new site collections.  We will use either PowerShell or Central Administration to backup the site collection including all content, create a new site collection, and restore the backup over the new site collection using PowerShell to overwrite the new site collection information.

Background:

–  You need to create a number of individual site collections using a consistent template.

–  The site uses custom styles and master pages as well as the publishing features.

–  You would like to make creating the sites as easy as possible by retaining the UI customizations and publishing settings.

Solution: 

–  Create a new content database and create your template site collection in that new content database.

–  Activate any necessary site collection and site features including the publishing infrastructure.

–  Upload your custom master page, styles, and images.

–  Apply your custom master page to the site at Site Settings: Look and Feel: Master page.

–  Add and update any new pages and web parts.

–  Create any sub-sites necessary including applying the custom master page, styles, and images.

–  Backup the new site collection using either Central Administration or PowerShell:

–  Central Administration – Go to the Backup and Restore page and then select “Perform a site collection backup.” Select the site collection you would like to backup and enter a path and filename for the backup.  Then click Start Backup.

–  PowerShell – Open the SharePoint PowerShell console and enter this command:

–  Backup-SPSite -Identity <Site collection name> -Path <backup file> [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]

–  Create a new content database.

–  Create a new blank site collection in the new content database.

–  Restore your site collection backup to the new site collection using PowerShell:

–  Open the SharePoint PowerShell console and enter this command:

–  Restore-SPSite -Identity <Site collection URL> -Path <Backup file> [-DatabaseServer <Database server name>] [-DatabaseName <Content database name>] [-HostHeader <Host header>] [-Force] [-GradualDelete] [-Verbose]

–  Go to your new site collection.

You can restore the template backup to as many new site collections as you would like.

Using this method allows you to create new site collections and keep the publishing feature enabled.  It will save many hours of duplicate work trying to create new sites.

For more great SharePoint tips, follow @CrederaMSFT on Twitter or on LinkedIn. If you have a SharePoint environment and need help please contact us.  We’ve helped some of the largest companies in the world upgrade and manage their SharePoint farms and would love to help you!