Currently I've got a custom site definition (SharePoint 2010) that includes several features and also puts some webparts in the webpartzones on the default.aspx when a site based on this definition is created. This works fine so far, but now I want to change the number and layout of the available webpart zones. I already created a new pagelayout that looks like I want:
<%@ Page language="C#" Inherits="Microsoft.SharePoint.Publishing.PublishingLayoutPage,Microsoft.SharePoint.Publishing,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document" meta:webpartpageexpansion="full" %> <%@ Register Tagprefix="SharePointWebControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <asp:Content ContentPlaceholderID="PlaceHolderPageTitle" runat="server"> <SharePointWebControls:FieldValue id="PageTitle" FieldName="Title" runat="server"/> </asp:Content> <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server"> <style type="text/css">
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
.left {
float: left;
}
.wpzone-left {
width: 80%;
}
.wpzone-right {
width: 20%;
}
}
</style><WebPartPages:SPProxyWebPartManager runat="server" id="spproxywebpartmanager"></WebPartPages:SPProxyWebPartManager><div class="clearfix"><div><WebPartPages:WebPartZone id="g_2B77BCE303404806BF11F38524B04EE7" runat="server" title="Header"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone></div><div class="left wpzone-left"><WebPartPages:WebPartZone id="g_C32EE71D668842E594AFD1E9F51303EE" runat="server" title="Left"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone></div><div class="left wpzone-right"><WebPartPages:WebPartZone id="g_8A8EB2A8290D42719116F76F6AE01F59" runat="server" title="Right"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone></div><div><WebPartPages:WebPartZone id="g_72C6A932C0B74F1DBDD73839578FB477" runat="server" title="Footer"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone></div></div></asp:Content>
The Page Layout path is ~sitecollection_catalogs\masterpage\PageLayoutRecord.aspx
It is checked in as major version and published.
In the onet.xml of the site definition I added the following: (because of this tutorial http://blogbaris.blogspot.be/2010/11/setting-default-page-layout-in-onetxml.html)
<WebFeatures><!-- Publishing --><Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416"><Properties xmlns="http://schemas.microsoft.com/sharepoint/"><Property Key="DefaultPageLayout" Value="~SiteCollection/_catalogs/masterpage/PageLayoutRecord.aspx"/></Properties></Feature>
The webparts are added to the default page via onet.xml as well:
<Modules><Module Name="DefaultBlank" Url="" Path=""><File Url="default.aspx" NavBarHome="True" Type="Ghostable"><NavBarPage Name="$Resources:core,nav_Home;" Url="~site" ID="1002" Position="Start" /><AllUsersWebPart WebPartZoneID="Header"
WebPartOrder="0"><![CDATA[<webParts><webPart xmlns="http://schemas.microsoft.com/WebPart/v3"><metaData>
...
etc
...But if I create a site based on the site definition the default page looks changed but it uses a page layout called WelcomeLinks or something like that.
Because of a hint I changed that part to:
<Modules><Module Name="MyPages" SetupPath="SiteTemplates\SPS" Url="Pages"><File Url="mypage.aspx" Path="default.aspx" Type="GhostableInLibrary"><Property Name="Title" Value="Home" /><Property Name="ContentType" Value="Welcome Page" /><Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/PageLayoutRecord.aspx" />http://stefan-stanev-sharepoint-blog.blogspot.de/2010/07/provision-publishing-pages-in-sandbox.htmlhttp://stefan-stanev-sharepoint-blog.blogspot.de/2010/07/provision-publishing-pages-in-sandbox.html
But it still tries to use the WelcomeLinks Page Layout if I create a new site... and even fails in the end, saying something like: "Failed to create modules from onet.xml when provisioning site at url "http://.../test1" with site definition"STS#0"