Office365 SP2013 SP2016
According to feedback received from some customers, there are users who have not been able to access sites created with a template; this happens with sites that include pages with custom page layouts.
Before getting into the details on how to fix this, please note that the previous article is a hack to save the site as a template, while saving a site as a template is disabled by default in all Publishing sites, and other type of sites with publishing features active. The hack may not work in all SharePoint scenarios.
After creating the site with a template, the user is presented with this message. It is displayed even if the page layout exists in the system.
All the pages with custom page layouts will become inaccessible and a reset to one of the default page layouts will be necessary.
Even though the message suggests that it can be fixed in the page settings, this page is also inaccessible and presents this message.
How to open the page settings
You can open the page settings from the Content and Structure option in the site settings. To open the site settings from the site showing the error you can access directly to this link
Once you are in the site settings click on Content and Structure located under site administration.
Select the Pages library, in the page with the custom page layout applied click in the name to the to open the context menu. From the menu select Edit Page Settings.
How to open the pages again?
This method requires you to run a custom PowerShell script to apply one of the default page layouts and it works for SharePoint Online and SharePoint OnPrem. The SharePoint online script can be executed in your personal computer, the SharePoint OnPrem script needs to be executed in your SharePoint server.
The PowerShell script is provided in the zip files bellow, download the zip file for your SharePoint version, extract the content and execute the ps1 file.
The script will request the following parameters:
- Site URL: Provide the link to the site showing the error message and exclude the pages library and the page name (e.g. /pages/default.aspx)
- Page Name: Provide the page name including the .aspx, you can copy it directly from the address bar
- User Name: Provide your user name, this parameter will be requested only on SharePoint Online
- Password: Provide your password, this parameter will be requested only on SharePoint Online
After executing the script, refresh the page settings and you will find the warning message bellow.
You should select one of the available page layouts, even if the desired page layout is not displayed, after selecting the page layout save the page settings.
Open the site created from the template, it will load with the page layout that you selected in the page settings.
Due to the different zones in the page layouts is possible that your page is not displaying any of the web parts included in the template.
To get the web parts back, edit the page and apply the original page layout.
Repeat this process to all the pages that are showing the error message.