Dissecting an Individual Site Definition
Site definitions consist of a hierarchy of files and folders that contain some specific entries. Each template requires three directories: DOCTEMP
, and XML
. The XML folder contains the ONET.XML
file, which is essential for creating the corresponding site. Although its contents are a bit messy, ONET.XML
contains all the major settings that you need for controlling initial site creation. The XML folder also contains a STDVIEW.XML
, which control the most basic list display control and allow you to adapt list appearance to meet your needs. You can see these basic display types in the list of options displayed when creating a new Viewstandard, datasheet, and calendar view base types. Additionally, the styles section of the view settings displays the different ways that the fields in the list can be displayed together.
In the DOCTEMP
folder you'll find the various template documents for the different kinds of files referred to by the ONET.XML
file in the <DocumentTemplate>
tag. These are the templates that SharePoint uses when you click the New Document button in a document library.
The LISTS folder contains a set of subfolders that correspond to the <ListTemplate> tags in the ONET.XML file. Each of these folders contains a SCHEMA.XML file that defines the fields, views, and general information about the appearance of the list within the site. The SCHEMA.XML fills essentially the same role as the ONET.XML file except that it operates within the scope of a list rather than a site.
Throughout the folder structure you'll find .aspx files. These are the Web Part pages that SharePoint uses to display your sites. Changes made to these files affect all the sites that still have that page ghosted. In essence a change to one of the .aspx files in the site definition directory can take effect across the entire set of sites created from the definition.
Dissecting the ONET.XML File
Because the ONET.XML file is a core file that tells SharePoint how to configure a newly created site, it's somewhat complicated; however, the major sections in the file are relatively straightforward after you examine them in a logical progression:
- Configurations maps the configurations referred to in the WEBTEMP*.XML file in the XML directory off of the locale ID folder. The configuration section tells SharePoint what things to include in a configuration including lists (ListTemplates), Web Parts, and Web Part pages (Modules).
- ListTemplates creates the templates for lists to be used by the configurations. It leverages the BaseTypes section to control the basic fields and other detail information, and describes global settings for the list, including its ID, descriptive text, and an image.
- BaseTypes defines the fields and views for a created list. The ListTemplates section uses the BaseTypes section to create a completely formed list.
- DocumentTemplates provide users with a list of document templates from which they can select the default document template for a Document Library when creating a document library list.
- Modules describes the files to be added to the SharePoint site and how those files should be configured. In SharePoint every Web Part page is a file. Because of this the modules section describes what Web Parts to display on a file. It also controls the appearance of the navigation bar on those pages.
- NavBars describes how the navigation bar should look. The navigation bar is the area at the top of the page that typically displays home, documents, lists, etc. This section controls the appearance of the navigation bar for all sites derived from this site definition.
While a detailed exploration of the ONET.XML
file is beyond the scope of the article, here's a typical customization sequence so you can see how the process works and some of the places where the file can be modified.