WSSv3, Provisioning a site (with master page and default.aspx) using a site definition

By | May 19, 2008

I have to create a site in Sharepoint (Wss) with a default pages in complete custom layout and custom menu and it has to be created as a package so the Wss site can be deployed to multiple sites.

I started by developing the master page with heather solomon’s simple masterpage as basis, Then i decided to develop a few features to deploy the master page, install the menu and provision a few standard pagelouts to the site. The master page and menu worked, but provisioning the default.aspx is not possible with features.

So I decided to make a switch to provision with a site defenition instead of features, it has some advantages over features, you can use the site definition to create a site at once instead of using the feature’s.

Step 1: Create your own Sitetemplate.

  • Go to “12TEMPLATE1033XML” and copy the file WEBTEMP.XML to WEBTEMPYOURTEMPLATE.XML
  • create your own template config:


  • Mind the ID part, just use a ID that doesn’t exist in WEBTEMP.XML .
  • create a directory in “12TEMPLATESiteTemplatesYOURTEMPLATE”
  • create a directory XML in your just created sitetemplate directory
  • Copy ONET.XML from “12TEMPLATESiteTemplatesstsxml” to “12TEMPLATESiteTemplatesYOURTEMPLATEXML”
  • Your site template will work now, nothing is changed though

Step 2: Create a master page and place it in “12TEMPLATESiteTemplatesYOURTEMPLATE”

  • Find the node in ONET.XML
  • Place a new module in de the Modules tag under configuration “
  • under the main node find and add:

     
  • Your master page will now be provisioned
  • To use it with all your provisioned pages find the Configuration ID=”0″  again and add the tag MasterUrl, like this: “

Step 3: Create site layout pages to provision and place them in “12TEMPLATESiteTemplatesYOURTEMPLATE”

  • Find the node in ONET.XML
  • Place a new module in de the Modules tag under configuration “
  • under the main node find and add:

         
         
           
                                 http://schemas.microsoft.com/WebPart/v2″>
                            Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
                            Microsoft.SharePoint.WebPartPages.ContentEditorWebPart
                            None
                                  None
                           
                      

                       ]]>
           

         

         
           
                                 http://schemas.microsoft.com/WebPart/v2″>
                            Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
                           Microsoft.SharePoint.WebPartPages.ContentEditorWebPart
                            None
                                  None
                           
                      

                       ]]>
           

         
  • You now will have 2 pages under http://yoursite/Sitepages based upon you own site layout pages defined in the Url propertie. This code will add a content editor webpart to your pages.

Step 4: Provision the new Default.aspx based on your own page layout

  • Find the node in ONET.XML
  • Place a new module in de the Modules tag under configuration “
  • under the main node find and add:

         
           
                                 http://schemas.microsoft.com/WebPart/v2″>
                            Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
                           Microsoft.SharePoint.WebPartPages.ContentEditorWebPart
                            None
                                  None
                           
                      

                       ]]>
           

       
  • Kocko

    Hi
    Not all the content is showing!