Creating site definitions is a good way to deploy customisations for different projects or clients. However if they all run on the same farm, how do you stop users from creating sites based on the wrong project?
By default if you create a site definition, it will appear in the Site Actions -> Create Site sites list (publishing feature), unless you have limited the site templates available through site settings.
But what if you dont want to allow the site owners access to provide these templates to their users? You can restrict it at the Site Definition level.
- Create an empty site feature called something like ‘Project.EnableSiteTemplates’ (set hidden=”TRUE” if you want to control the feature activation via Site Def or STSADM only – not through Site Settings)
- In the webtemp*.xml for your site definition, in each <Configuration> template node set the VisibilityFeatureDependency property to the GUID of your newly created feature so that the site only appears for users to select in Create Site box when that feature has been activated. eg. VisibilityFeatureDependency=”7C30466D-62A2-43eb-99EB-7650E5D14B77″
- In your onet.xml file of the project Site Definition, enable the ’Project.EnableSiteTemplates’ feature in the <SiteFeatures> section, so when your new site collection is created it also enables your site templates for this project.


