Friday, June 15, 2007

Setting AvailableWebTemplates and AvailablePageLayouts in SiteDefinition

When creating customized Site Templates (Site Definitions) in SharePoint (2007), you may want to define which WebTemplates and PageLayouts that should be available on each Site.

To do so, locate the following Feature in onet.xml:

[Feature id="22A9EF51-737B-4ff2-9346-694633FE4416"]

Add a Propery tag for both AvailableWebTemplates, and AvailablePageLayouts under Properties as shown here:

[properties]
[property key="AvailableWebTemplates" value="*-MyCustomSiteTemplate#3"]
[property key="AvailablePageLayouts" value="~SiteCollection/_catalogs/masterpage/MyCustomPageLayout.aspx"]
[/properties]

"3" corresponds to the Configuration ID in onet.xml

To define multiple pagelayouts, seperate each layout with a colon ":"

You can also add additional Property-Settings like WelcomePageUrl, PagesListUrl, AlternateCssUrl, etc. within the Properties-tag.

I will post an url to the optional Property values, when and if I can locate them :-)

Business Card