Change the default page when site is created

When you create a new publishing site in MOSS it automatically gets a default page created using the WelcomeLinks.aspx page layout. How can you change this behavior and have it automatically create a page based on a content type and page layout of your choice? Read on to find out how.

The Publishing template (as do all templates) have an ONET.XML file. In this file there is a modules section (as below), this defines the PublishingPageLayout and ContentType to be used when a site is created.

<Modules>     <Module Name="Home" Url="$Resources:cmscore,List_Pages_UrlName;" Path="">         <File Url="default.aspx" Type="GhostableInLibrary" Level="Draft" >             <Property Name="Title" Value="$Resources:cmscore,IPPT_HomeWelcomePage_Title;" />             <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/WelcomeLinks.aspx, ~SiteCollection/_catalogs/masterpage/WelcomeLinks.aspx" />             <Property Name="ContentType" Value="$Resources:cmscore,contenttype_welcomepage_name;" />         </File>     </Module> </Modules>

This could be changed to specify any default content type and page layout. The following shows how you might change it to a content type called MyContentType and a default page layout called MyPageLayout.aspx;

<Modules>     <Module Name="Home" Url="$Resources:cmscore,List_Pages_UrlName;" Path="">         <File Url="default.aspx" Type="GhostableInLibrary" Level="Draft" >             <Property Name="Title" Value="$Resources:cmscore,IPPT_HomeWelcomePage_Title;" />             <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx, ~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx" />             <Property Name="ContentType" Value="MyContentType" />             <Property Name="PublishingAssociatedContentType" Value=";#MyContentType;#0x010100C568…3A09F31E1FBA;#" />         </File>     </Module> </Modules>

Note: The big number 0x010100C568…3A09F31E1FBA is obtained from the Url of the Content Type.