How to: Create Custom Collaboration Portal Site Definitions in SharePoint Server 2010 (ECM)

Applies to: SharePoint Server 2010

In Microsoft SharePoint Server 2010, a site definition is a set of predefined components that must be included when a site is created, so that Web Parts, lists, Features, and navigation bars can be included in the site. By default, SharePoint Server 2010 includes several site definitions that you can choose from to build your site. If you want to include more or different Web Parts, lists, Features, or navigation bar components than those delivered by default, you can create a custom site definition.

In the file system, site definition files are available in the %Program Files%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\SiteTemplates folder. Each site definition includes an XML folder and a home page (default.aspx). The XML folder contains the ONET.XML file, which stores information about all of the Web Parts, lists, Features, and navigation bars that are used on the site. The configuration of site definitions is stored in another XML file that is available in the %Program Files%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\1033\XML folder. Collaboration portals use the SPSPORTAL site definition, which is in the WEBTEMPSPS.XML file.

The basic site definitions for portal sites are available in the %Program Files%\Common Files\Microsoft Shared\web server extensions\14\Template\Site templates\SPS folder. Making any changes directly to the templates in this folder is not recommended or supported by Microsoft. Future updates will overwrite the custom definition.

To create a custom site definition for a portal site

  1. In Windows Explorer, go to 14\Template\Site templates\SPS, create a copy of the SPS folder, and rename it to SPS* (where * represents characters that you choose).

  2. Create a copy of the WEBTEMPSPS.xml file and name it WEBTEMP*.xml.

  3. Edit WEBTEMP*.xml, and define custom site definitions, including the site definition for the portal site.

  4. The template for SPS is defined in WEBTEMPSPS.xml, under configurationid=20. Copy the template definition and paste it into your WEBTEMP*.xml file.

  5. Set the Template ID to be a unique value that is greater than 10000.

  6. Rename the template to be SPS* (or the folder name that you created by copying the SPS folder).

  7. The template for the portal site is defined in WEBETEMPSPS.xml, under configurationid=47, with the PortalProvisioningProvider class.

  8. Copy this template definition into your WEBTEMP*.xml file.

  9. Set the ConfigurationID to be a unique value that is greater than 10000.

  10. Change the template name and title to be the template name and title that you want to use.

  11. Optional: Delete the remaining template definition.

    Use the following code example to create the WEBTEMP*.xml file.

    <?xml version="1.0" encoding="utf-8"?>
    <!-- _lcid="1033" _version="14.0.4518" _dal="1" -->
    <!-- _LocalBinding -->
    <Templates>
    <! –- Replace SPS* with the name of your template in <Template Name>. -->
    <Template Name="SPS*" ID="10001">
    <Configuration ID="0" Title="My Site Definition" Hidden="FALSE" 
    ImageUrl="/_layouts/images/blogprev.png"
    Description="A site for a person or team to post ideas, observations, and expertise that site visitors can comment on."
                  DisplayCategory="Custom" >
                  </Configuration>
           </Template>
    
    <Template Name="SPSTEST" ID="10002">
        <Configuration ID="0"
    Title="My Collaboration Portal"
    Type="0" Hidden="FALSE"
    ImageUrl="/_layouts/1033/images/template_corp_intranet.png"
    Description="A starter site hierarchy for an intranet divisional portal. It includes a home page, a News site, a Site Directory, a Document Center, and a Search Center with tabs. Typically, this site has almost as many contributors as readers and is used to host team sites." 
    ProvisionAssembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ProvisionClass="Microsoft.SharePoint.Publishing.PortalProvisioningProvider"
     ProvisionData="sitetemplates//Webmanifest//portal*.xml"
    RootWebOnly="FALSE"
    
    
    DisplayCategory="Custom">
       </Configuration> 
     </Template> 
    
  12. In the …14\Template\Site Templates\WebManifest folder, create a copy of PORTALWEBMANIFEST.xml and name it PORTAL*.xml.

  13. In PORTAL*.xml, for the HOME(Portal) web, set the SiteDefinition as your custom SPS*. For the remaining webs (the remaining sites under portal), set any custom site definitions that you have, as shown in the following code.

    <?xml version="1.0" encoding="utf-8"?>
    <!-- _lcid="1033" _version="12.0.4518" _dal="1" -->
    <!-- _LocalBinding -->
    <portal xmlns="PortalTemplate.xsd">
      <!—Define your portal site name and SiteDefinition name. -- >
      <web name="HomeNew" siteDefinition="SPS*"
    displayName="$Resources:cmscore,IPPT_Portal_Root_DisplayName;"
    description="$Resources:cmscore,IPPT_Portal_Root_Description;">
         <webs>
         < -- Define your site name and the site definition name that you want to create under the portal.-- >
             <web name="TEAM" siteDefinition="STS" displayName="My team"
    Description="$Resources:spscore,PortalManifest_News_description;"/>
            <! –- The STS site definition is assigned to the Team Site here. You can set your custom definition for the sites. -- >
            </webs>
         </web>
      </portal>
    
  14. In WEBTEMP*.xml, set the provisiondata path to the PORTAL*.xml path (for example, Site Templates//Webmanifest//Portal*.xml).

  15. Save changes in all files.

  16. Using IIS Manager or the IISReset command-line utility, restart Internet Information Services (IIS).

When you create a site, the custom site definition appears under the Custom display category. Use this template to create a custom portal site.

See Also

Other Resources

Overview of Creating Custom Site Definitions

How to: Create a Custom Site Definition and Configuration

Site Types: WebTemplates and Site Definitions

Web Templates

Site Definitions and Configurations

Understanding Onet.xml Files

Understanding WebTemp*.xml Files