Geeks With Blogs
Realizing Results my personal notes on C#, SharePoint and object oriented programming

Creating a Custom Site Definition:



Adding Pages to a Site Definition:

Each page in the onet.xml is defined in a <Module> tag.

For e.g.


Similarly if we want to add more than one page we can add the same in module tag.

For e.g.


All these <module> tags are defined under <Modules> tag.

Remember there can be a number of <module> tags but only ONE <Modules> tag.

Now each site made using this site structure will have three pages created automatically.


The <Module Tag>

<ModuleName="EventOverview"   Url="$Resources:cmscore,List_Pages_UrlName;"Path="">

 <FileUrl="EventOverview.aspx"Type="GhostableInLibrary" >

<PropertyName="Title"     Value="$Resources:cmscore,IPPT_HomeSMSPWAePage_Title;" />

<PropertyName="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/EventsOverviewLayout.aspx, ~SiteCollection/_catalogs/masterpage/EventsOverviewLayout.aspx" />



·  Each module tag defines the page that will be created.

·  The file tag gives the url of the page.( make a copy of default.aspx and rename it as EventOverview.aspx in the TestStructure Folder)

·  Type=”GhostableInLibrary” will tell sharepoint to create an instance of this particular page in the pages library of the corresponding site.

·  Various properties can also be set using the <Property> tag. For eg we can specify the layout which this page should refer to while it gets created.(in this case it is referring to a custom layout EventsOverviewLayout.aspx)

·  (how to refer layouts is discussed later)

·  Like this as many modules can be added according to the requirement.

·  The <Modules> tag will also get registered in the <Configuration> tag of Onet.xml  

·  For e.g.

              The <configuration> Tag



                <ModuleName="LoginPage" />

                <ModuleName="Images" />

                <ModuleName="Home" />

                    <ModuleName="SMSPWAHome" />        




Referring Custom Layouts to the Pages: 

Layout pages are present in the /_catalogs/MasterPage of the site!

We can define our own custom layout page in the master page gallery.

By default MOSS does not allow the subsite to inherit the page layout from the parent site.

 To enable this we can go to

“Parent Site “> Site Actions > Site Settings > Modify All Site Settings > PageLayout and Site Template Settings >

Here we can set the subsite to inherit templates and pagelayouts from the parent site itself.


·         In the Onet.xml we need to give reference of the Custom Layout for a page.

In the < module > tag, set the property to refer the layout.

<FileUrl="default.aspx"Type="GhostableInLibrary" >

<PropertyName="Title"Value="$Resources:cmscore,IPPT_HomeSMSPWAePage_Title;" />

<PropertyName="PublishingPageLayout"Value="~SiteCollection/_catalogs/masterpage/CustomLayout.aspx, ~SiteCollection/_catalogs/masterpage/CustomLayout.aspx" />



After finishing with this, the user can just reset the IIS and create a site. The site will be created according to the desired structure and the layout!


Posted on Monday, November 8, 2010 12:34 PM | Back to top

Comments on this post: Custom Site Definition in Microsoft SharePoint 2007

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Manish Sati | Powered by: