Reading Sitecore manuals or digging in the Internet you probably see a following statement: “Information Architecture is very important for Sitecore solution”. So I would like to share some thoughts and approached.
Nowadays I’m mainly working with MVC and this post is also about it, but a lot of stuff could be applicable to WebForms as well.
Projects organization in solution
It doesn’t really matters whether you working with multi- or single- site project, you should always treat it as multi-site, as you customer will ask you one day to add something and you should be ready for this kind of requests. On the other hand it should be easy for you to manage different sites.
First of all you should distinguish common part in you project. This part will be responsible for:
- Configuration of site in general (project should contain web.config and patch configuration that affect all Sitecore instance)
- Common pipelines, helpers, jobs and so on
- Styles, scripts and other assets that should be shared between sites.
Second and really important step is to define naming convention for your project. This mean that in Sitecore content tree, source code and on file system you should have similar structures:
Files in website project should be organized in folder structure that contain SiteName in it (e.g. <website root>/static/common/js ot <website root>/static/common/css). When all your sites will be deployed you will get nice structure:
../Site 1 ..../static ....../js ....../css ....../img ../Site 2 ..../static ....../js ....../css ....../img
Namespace could be like this <Client>.<Site>.<Module> (e.g. SomeClient.Common.Website or SomeClient.Common.Helpers)
Configuration files in App_Config/Include should include project namespace in it.
* In order to process your config after all sitecore ones put “_” on the first place of you patch config file name (for site specific configs add “_” two times)
You should use MVC areas in each project, in order to separate views in the save way as described for static files.
* You could give SiteName to area and exclude area folder from namespace generation in Visual Studio, and you will get nice namespace without duplications.
Sitecore Content tree
For content tree you should try to use same approach as for file system. You should use SiteName as a root folder for your custom items in each main node:
Sitecore Content Site 1 Site 2 Layout Layouts Site 1 Site 2 Renderings Site 1 Site 2 Media Library Site 1 Site 2 System Dictionary Site 1 Site 2 Templates Site 1 Site 2
When you follow suggestions above you could deploy several sites in one instance of Sitecore and easily manipulate them afterwards, as all elements of you solution will be nicely structures withing filesystem, content tree and VS solution.
PS: in order to marry Sitecore with MVC areas you should do manipulations that I was described in another post.