Setting the default page layout in onet.xml (SharePoint 2010)

In SharePoint 2010 you have the option to choose a default page layout when you create a page.

Setting the default page
When you create a new page, a dialog pops up where you enter the name of the site.



You can configure your onet.xml and define the default page by the defaultpagelayout property in the publishing feature.



Or you can set it programmatically as described in SharePoint Blues.

There are also several other properties offered by the Publishing feature you can set:

  • ChromeMasterUrl
  • WelcomePageUrl
  • PagesListUrl
  • AvailableWebTemplates
  • AvailablePageLayouts
  • NewPageUrlToken
  • AlternateCssUrl
  • SimplePublishing
  • VersioningOnPages / Documents / Images
  • EnableModerationOnPages / Documents / Images
  • EnableApprovalWorkflowOnPages / Documents / Images
  • RequireCheckoutOnPages / Documents / Images
  • EnableSchedulingOnPages /Documents / Images
  • AllowSpacesInNewPageName

Each property needs a different value. You can find a good listing of the properties and values to use on blog post of Carsten Keutmann.

If SimplePublishing is set to false, all the properties concerning versioning, moderation, workflowapproval, checkout and scheduling are set to true. Otherwise all are set to false. But you can override them when you use p.e. "SimplePublishing" = true and set VersioningOnDocuments = true;

Interesting is also the new "AllowSpacesInNewPageName" property. It does what he says. If set to false, the checkbox for "Convert spaces to '-' " in the site property settings is checked and spaces are converted to '-'.

Convert Spaces to '-'
In code-behind the web property "__AllowSpacesInNewPageName" is set to true.

If the Publishing Feature gets activated, a web property called "__PublishingFeatureActivated" is set to true.

Comments

Anonymous said…
Excellent! Exactly what I was looking for!

Popular posts from this blog

Open SharePoint 2010/2013 Display, Edit, New Forms in Modal Dialogs

Ways to redirect http requests in SharePoint

Using WebDav on IIS 7 to access UNC Paths