When
we create a site based on one of the SharePoint site templates and visit the
site, usual behavior is to automatically redirect to the default.aspx page of
the new site. (<NewSiteURL>/Pages/default.aspx),
which is sometimes not what we want. When creating custom site templates we can
change this behavior in the SharePoint Server Publishing feature as this
default page is created automatically by publishing feature.
Set about-us.aspx
as the Default page (Welcome page)
Create
a new module for the custom default page like shown below and put the
about-us.aspx page beside the default.aspx in the SiteTemplate
folder.
<Module Name="AboutUs" Url="$Resources:osrvcore,List_Pages_UrlName;" Path="">
<File Url="
about-us.aspx "
Type="GhostableInLibrary" >
<Property Name="Title" Value="AboutUs" />
<Property Name="Comments" Value="About Us Page" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/PageLayout1.aspx, PageLayout
01 Title" />
<Property Name="ContentType" Value="My Article Page" />
</File>
</Module>
Then
set WelcomePageUrl property in the Publishing feature
as below.
<Property Key="WelcomePageUrl" Value="$Resources:osrvcore,List_Pages_UrlName;/about-us.aspx"/>
Set
PageLayout1.aspx as the Default PageLayout
Use
DefaultPageLayout property in the Publishing feature
as below.
<Property Key="DefaultPageLayout" Value="~SiteCollection/_catalogs/masterpage/PageLayout1.aspx"/>
So
the publishing feature with a custom default page and a custom default Page
Layout will look like this.
<!--Publishing feature-->
<Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">
<Properties xmlns="http://schemas.microsoft.com/sharepoint/">
<Property Key="ChromeMasterUrl"
Value="~SiteCollection/_catalogs/masterpage/MyAboutUs.master"/>
<Property Key="WelcomePageUrl" Value="$Resources:osrvcore,List_Pages_UrlName;/about-us.aspx"/>
<Property Key="SimplePublishing"
Value="false" />
<Property Key="DefaultPageLayout" Value="~SiteCollection/_catalogs/masterpage/PageLayout1.aspx"/>
</Properties>
</Feature>