Issue when provisioning generic pages in SharePoint

Few posts ago – I was talking about a scenario where you might need to provision many sites with generic default.aspx  page template. Of course, when you provision a site, a default.aspx page will not get a title on it’s own. You need to set the title of the page – otherwise your page header as well as title will be blank.

In my article, Setting automatic page title for SharePoint Default pages, I talked about a solution where you create a feature which is called right after site provisioning and that feature has a receiver setting the title of the page for you. However, there is a problem, if your template’s default.aspx  page doesn’t have Title property defined (it’s ok for it to be blank) – your feature will error out and not set the title properly.

When provisioning your generic page based on a custom template, follow the format below:

<?xml version=”1.0″ encoding=”utf-8″?>
<Elements xmlns=”http://schemas.microsoft.com/sharepoint/“>
  <Module Name=”Content” Url=”Pages” Path=”">
    <File Name=”Default.aspx” Url=”Default.aspx” Type=”GhostableInLibrary”>
      <Property Name=”ContentType” Value=”CrnBCGeneralPage” />
      <Property Name=”PublishingPageLayout” Value=”~SiteCollection/_catalogs/masterpage/MyGenericLayout.aspx, MyGenericLayout;” />
      <Property Name=”Title” Value=”"/>
    </File>

  </Module>
</Elements>

This entry was posted in MOSS, sharepoint and tagged , , , . Bookmark the permalink.

Comments are closed.