In Microsoft SharePoint 2010, you can create new sites from site definitions by clicking New Site on the Site Actions menu. You can create new site definitions in Microsoft Visual Studio 2010 and then deploy them to SharePoint 2010. This SharePoint Visual How To demonstrates how to create a new site definition and then add a Web Part to the site's default.aspx page. The Web Part filters tasks based on their due dates.
This Visual How To describes the following steps for creating and deploying a site definition in Visual Studio 2010:
Creating a SharePoint 2010 site definition application in Visual Studio 2010.
Editing the onet.xml file to include a list.
Adding a Web Part to the Site Definition project.
Adding the Web Part to the default.aspx page.
Creating a new site based on the site definition.
To create a SharePoint 2010 Site Definition project in Visual Studio 2010
Start Visual Studio 2010. On the File menu, click New, and then click Project.
In the New Project dialog box, in the Installed Templates section, expand either Visual Basic or Visual C#, expand SharePoint, and then click 2010.
In the template list, click Site Definition.
In the Name box at the bottom, type FilteredTaskSite.
Leave the default values in the other fields, and click OK.
Under What local site do you want to use for debugging?, select your site. Click Finish.
To modify the onet.xml file
In Solution Explorer, under the SiteDefinition node, open the onet.xml file.
Add the following markup between the <NavBars> </NavBars> tags.
In Solution Explorer, right-click the project, and then select Deploy.
Open the SharePoint Home page.
Above the ribbon, click Site Actions, and on the menu, click New Site.
In the list of templates, select FilteredTaskSite, and using the form on the right side, create a new site.
The new site appears with the Project Tasks list on the Quick Launch menu and the new Web Part on the default page. Add a few tasks with different due dates, and then use the Web Part on the home page to filter items that have a due date on or before the selected date.
The onet.xml file contains information about a new site definition. This example demonstrated the following tasks:
Creating a task list named Project Tasks and adding it to the Quick Launch navigation bar.
Adding a Web Part to the project that filters tasks based on their due dates.
Editing the default.aspx page so that it includes the new Web Part.