How to create site definition in SharePoint 2010?
Let’s start this blog by understanding the difference between Site Definition and Site Template.
Site Template is a ready made layout that we can use to create a site. It has pre-defined top nav, quick launch, list etc.
Site Definition is a custom layout that we can create. We can define our own header, footer, top nav, quick bar. Generally, we work with existing Site Template, for a minimal modification in the layout we managed with style sheet or some other techniques then continue. But for major changes in existing site template better to create own Site Definition.
Now we can move to our topic about “How to create a site definition in SharePoint 2010”
Follow below steps:
Create a SharePoint Project in Visual Studio:
Type site URL where you want to deploy this.
Add a visual web part which will be added to default.aspx page
Your solution explorer will look like below screen:
Made changes in onet.xml such as List, Library, Top Nav Bars etc (Refer above screen)
Open Default.aspx page(from SiteDefinitionfolder)
Register webpart tag
<%@ Register TagPrefix=”MyWebPartControls” Namespace=”FilteredTaskSite.TaskVisualWebPart” Assembly=”$SharePoint.Project.AssemblyFullName$” %>
Now place webpart tag in content place holder
<MyWebPartControls:TaskVisualWebPart runat=”Server” />
Deploy this solution to your SharePoint site.
Go to Site Actions – > New Site
You will find your newly created site template will be available there.
You can customize site definition in visual studio as per your requirement.
Please follow and like us: