Thursday, April 9, 2009

Best Practices for SharePoint - Blank Sites

If you ever plan on creating a new site, which starts off on a clean slate, especially with the WCM Publishing Features activated you must use stsadm to do that. Effectively three commands will get you started nice and simple with the most blank publishing site you can immagine:

a) create an absolute blank sitecolleciton with really nothing in it
stsadm -o createsite -url http://servername -ownerlogin domain\username -owneremail

b) activate the publishing feature on the site collection level
stsadm -o activatefeature -name PublishingSite -url http://servername

c) activate the publishing feature on the web level
stsadm -o activatefeature -name PublishingWeb -url http://servername

That's it. go to your url and you will find the most minimalistic publishing site you will be able to get that has all the publishing features activated.
Now you can start building your own site template based on this and be sure that content deployment will give you less headaches should you ever decide to go down that route in future.


Beldar's Blog said...

Hi Alex,

What is meant by the Web level? The third step. Is that just withing the site collection being created? What does that step do?


Neil McNeely

Alex Dean said...

Features are deployed to a specific scope. In SharePoint there are four scopes which features can be activated on: Farm, Web application, Site Colleciton and Web.
Farm features affect the whole farm. Themes and templates are offen deployed to the farm.
Web Application features only affect the web application they have been deployed to. This often goes hand in hand with web config modifications or solutions which shall affect all site collecitons in a web application.
Site Collection features only affect the site collection they have been activated on. This often includes content types, list definitions, custom application pages and templates.
Finally, Web Features only affect the web/site they are activated on. This can be the root web of the site collection or any sub-web within the site collection.
The publishing feature will create a Pages library in the SharePoint web/site with the required content types enabled and enable all publishing web parts on the the web/site.

Developers most often get confused between the different terms used in SharePoint.
A SPSite object represents a Site Collection
A SPWeb object represents a single Site.
The word Site and Web is used interchangably in SharePoint speak.