I created a custom site template for Sharepoint 2010. In this template is automatically activated SharePoint Server Publishing feature by this code in onet.xml:
<WebFeatures>
<Feature ID="94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" />
</WebFeatures>
I have also specified module for default page in onet.xml in this way:
(in configuration section):
<Modules>
<Module Name="DefaultBlank" />
</Modules>
(and specified under configuration section):
<Module Name="DefaultBlank" Url="" Path="">
<File Url="default.aspx" Name="default.aspx" NavBarHome="True" Type="Ghostable">
</File>
</Module>
But when I create site based on this template Sharepoint automatically redirect to NewSiteURL/Pages/default.aspx, which is something what I do not want. This default page is created automatically by publishing feature and it is blank. But I want as default page my prepared default.aspx, so address should be just NewSiteURL/default.aspx. I tried set this up by property of Publishing feature:
<Feature ID="94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb">
<Properties xmlns="http://schemas.microsoft.com/sharepoint/">
<Property Key="WelcomePageUrl" Value="~/default.aspx"/>
</Properties>
</Feature>
But it's not working. Does anybody know how to resolve this problem?
UPDATE:
I tried solution from Chakkaradeep but no luck with it :(. I still see blank default page when I created a site. My onet.xml now:
<?xml version="1.0" encoding="utf-8"?>
<Project Title="Custom Publishing Site" Revision="2" ListDir="" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/">
<NavBars>
</NavBars>
<Configurations>
<Configuration ID="0" Name="Custom Publishing Site" CustomMasterUrl="_catalogs/masterpage/publish.master">
<Lists/>
<SiteFeatures>
<!-- Aggregation lists + instances -->
<Feature ID="465138bd-5cbb-477c-9148-0f0846f6c323" />
<!-- Publishing Site Infrastructure -->
<Feature ID="f6924d36-2fa8-4f0b-b16d-06b7250180fa" />
<!-- Custom Content Types-->
<Feature ID="d86c7005-d31d-43ae-b86b-38f28b81072e" />
<!-- Custom styles + images -->
<Feature ID="cfac09fe-5aff-4b66-8c3c-22ec02af3af5" />
</SiteFeatures>
<WebFeatures>
<!-- Master Page -->
<Feature ID="4dae3485-c2e5-4c07-adcc-28a7417b6dd9" />
<!-- Page layouts --><!--
<Feature ID="985b3cfc-728c-4459-90d9-5d02de88857a" />-->
<!-- Publishing Feature -->
<Feature ID="94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb">
<Properties xmlns="http://schemas.microsoft.com/sharepoint/">
<Property Key="WelcomePageUrl" Value="$Resources:osrvcore,List_Pages_UrlName;/Default.aspx" />
<Property Key="SimplePublishing" Value="true" />
</Properties>
</Feature>
<!--Lists definitions + instances-->
<Feature ID="be3732cc-6f55-41c1-b62c-a24a43540fad" />
<!--Default Page Setting-->
<Feature ID="538e4d0c-d335-4ce1-a2d9-bfc94f78e6c8" />
</WebFeatures>
</Configuration>
</Configurations>
</Project>
As you can see I deplying also custom master page + list definitions on web scope. Last feature is my custom default page. It's in module called DefaultPage and elements.xml of this module looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="DefaultPage" Url="$Resources:cmscore,List_Pages_UrlName;">
<File Url="default.aspx" Type="GhostableInLibrary" Path="DefaultPage\default.aspx" IgnoreIfAlreadyExists="TRUE" >
<Property Name="Title" Value="Home" />
<Property Name="IncludeInGlobalNavigation" Value="FALSE" />
<Property Name="ContentType" Value="Welcome Page" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/BlankWebPartPage.aspx, Blank Web Part page" />
</File>
</Module>
</Elements>
In default.aspx file is just this code:
<%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<%@ Reference VirtualPath="~TemplatePageUrl" %>
<%@ Reference VirtualPath="~masterurl/custom.master" %>
All my changes are mostly copied from Chakkaradeep's example solution which is working fine. So I really don't know where can be a problem.