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 apply to WebForms as well.
Projects organization in solution
It doesn’t matter whether you working with a multi- or single-site project, you should always treat it as multi-site, as your customer will ask you one day to add something and you should be ready for this kind of request. On the other hand, it should be easy for you to manage different sites.
First of all, you should distinguish common parts in your project. This part will be responsible for:
- Configuration of the site in general (project should contain web.config and patch configuration that affects all Sitecore instance)
- Common pipelines, helpers, jobs, and so on
- Styles, scripts, and other assets that should be shared between sites.
The second and really important step is to define a naming convention for your project. This means that in Sitecore content tree, source code, and on the file system you should have similar structures:
Files in website project should be organized in folder structure that contain SiteName in it (e.g. /static/common/js ot /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 .. (e.g. SomeClient.Common.Website or SomeClient.Common.Helpers)
Configuration files in App_Config/Include should include project namespace in it.
- To process your config after all Sitecore ones put “” on the first place of your patch config file name (for site-specific configs add “” two times)
You should use MVC areas in each project, to separate views in the same way as described for static files.
- You could give SiteName to the area and exclude the area folder from namespace generation in Visual Studio, and you will get a nice namespace without duplications.
Sitecore Content tree
For the content tree, you should try to use the same approach as for the 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 the suggestions above, you could deploy several sites in one instance of Sitecore and easily manipulate them afterward, as all elements of your solution will be nicely structured within the filesystem, content tree, and VS solution.
PS: To leverage Sitecore with MVC areas, you should do manipulations that I was described in another post.