Tag: homepage

In order to set the welcome page of a web template, the documented and most common way is to use the publishing feature in your onet.xml, which have a feature parameter for setting the welcome page. Sometimes you don’t want to use the publishing framework for various reasons. In my case I was creating a variant of the team site STS#0 web template, and in my opinion the publishing feature does not belong in a team site – especially if it’s just there for setting the welcome page.

Surprisingly Google does not give any results on how to set the welcome page url declaratively (without resorting to the publishing feature), only programmatically. The solution is actually very simple, and was discovered by setting a custom welcome page in a web, exporting the web as template and investigating the modules inside the exported .wsp. The welcome page url property is persisted using the rootfolder’s property bag.

To set a custom welcome page in a web template using no-code and no-publishing, do the following

Create a web-scoped feature, e.g. WebTemplatePropertyBagFeature

Add an empty element, e.g. WelcomePageProperty, to the project and to the feature above. The Elements.xml for the WelcomePageProperty element should look similar to the following (replace SitePages/MyCustomFrontPage.aspx with the name of the page you want to use as frontpage for the web)