I am working on a SharePoint server 2013 (latest build number 15.0.4875.1000). and i am facing a problem when saving a site as template. As the custom master page will no be applied to any new site created based on the template
Now here is the scenario to reproduce the problem:-
- I created a new site collection of type Team site.
- I enable these 2 features inside the site collection :-
- SharePoint Server Publishing Infrastructure - Site collection feature-
- SharePoint Server Publishing - site feature-
- then i download the
seatle.master
master page for the site collection. - I apply some modification to the master page. such as:-
- i moved the search-box to be on the upper left corner of the page (under the setting gear icon). this is the code which i moved :-
<SharePoint:AjaxDelta id="DeltaPlaceHolderSearchArea" BlockElement="true" CssClass="ms-mpSearchBox ms-floatRight" runat="server"> <asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"> <div id="searchInputBox"> <SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" /> </div> </asp:ContentPlaceHolder> </SharePoint:AjaxDelta>
- i apply a footer.
<div id="customFooter" class="noindex">© our company name</div> </div> </SharePoint:SharePointForm>
- add the current date time above the search as follow:-
- I set the new master page as defualt.
- and i went to "site setting>>look and feel>>master page>> i set an Alternate CSS URL".
- then under the sit collection, i create a new sub-site of type team site (name it
SubSiteA
). - then i went back to the site collection "site setting>>look and feel>>master page" i set to reset and apply the master page on all the sub-sites.
.
- So now i have
SubSiteA
having the same master page customization as in its parent site collection. which is fine till now.
--Problem start here---
- now inside
SubSiteA
, i save the site as template. - and i create a new sub-site (name it
SubSiteN
) and i chose the above temple.but the problem is that inside the new sub-siteSubSiteN
which i create based on the template , i note that the master page modifications are not there, while it is referencing the alternate css. For example on the new sub-site (subsiteN
), the search box, the date/time and the footer are not there , as follow:-
To force SubSiteN
to use the custom master page i need to go back to the site collection and chose to reset the master page for all the sub-sites. but i do not want to keep doing this each time i create a new sub-site based on the template.
so can anyone advice on this please?
Further info. now i checked the master page inside SubSiteN
using sharepoint designer and it looks as follow:-
and the _devicechanelmapping
file is as follow,where it is correctly referencing the custom.master
,, but not sure why the custom master page was not applied correctly on the new subsite which i create based on the template:-
<%@ Reference VirtualPath="~CustomMasterUrlForMapping0" %><%@ Page Language="C#" Inherits="Microsoft.SharePoint.Publishing.Internal.WebControls.MappingsFileBasePage" %><%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<head>
<meta name="WebPartPageExpansion" content="full" />
<!--[if gte mso 9]>
<SharePoint:CTFieldRefs runat=server Prefix="mso:" FieldList="FileLeafRef"><xml>
<mso:CustomDocumentProperties>
<mso:ContentTypeId msdt:dt="string">0x010100FDA260FD09A244B183A666F2AE2475A6004CEB6EC65F9F2646A882D81830A08C7E</mso:ContentTypeId>
<mso:FSObjType msdt:dt="string">0</mso:FSObjType>
<mso:Order msdt:dt="string">700.000000000000</mso:Order>
<mso:FileDirRef msdt:dt="string">test22/_catalogs/masterpage</mso:FileDirRef>
<mso:FileLeafRef msdt:dt="string">__DeviceChannelMappings.aspx</mso:FileLeafRef>
<mso:ContentType msdt:dt="string">Device Channel Mappings</mso:ContentType>
<mso:UIVersion msdt:dt="string">15</mso:UIVersion>
</mso:CustomDocumentProperties>
</xml></SharePoint:CTFieldRefs><![endif]-->
</head><body><mappings>
<defaultChannelMapping>
<siteMasterUrl token="~sitecollection/_catalogs/masterpage/Custom.master" href="/_catalogs/masterpage/Custom.master" />
<systemMasterUrl token="~sitecollection/test22/_catalogs/masterpage/seattle.master" href="/22/_catalogs/masterpage/seattle.master" />
<alternateCssUrl token="" href="" />
<themedCssFolderUrl token="" href="" isthemeshared="false" />
</defaultChannelMapping>
</mappings></body></html>
can anyone advice how i can preserve the master page customization inside the site template ?
EDIT 4 December 2016 now i follow the same process as mentioned inside this link
jeffreypaarhuis.com/2011/10/21/your-master-page-automatically-on-newly-created-subsites/
where i mainly did the following steps:
- i download the site template from "site setting">>"solutions".
- i open the site template inside visual studio.
- i modify the ONet.xml file .
- where i changed this :-
-
<Configuration ID="0" Name="Default" MasterUrl="/_catalogs/masterpage/seatle.master" CustomMasterUrl="" ThemedCssFolderUrl="">
To reference the custom master page:-
<Configuration ID="0" Name="Default" MasterUrl="/_catalogs/masterpage/Custom.master" CustomMasterUrl="" ThemedCssFolderUrl="">
- i rebuild, then publosh the wsp file inside visual studio (where i have define "False" for "Include assembly in project").
i re-upload the updated wsp site template inside my "Site Settings">>"Solutions".
i activate the solution.
- i create a new sub-site based on the template. but i got this error on the sub-site home page
so i re-modify the site template inside visual studio and i explicitly define the master page Absolute URL as follow:-
i upload, activate the new solution.
but when i create a new sub-site based on the template, i did not get any error but the custom.master page was not applied!!
so can anyone adivce on this please ?
Thanks