Sitecore Helix Principles | Ayman Elbadawy

Layouts, Renderings, and Placeholders

In Sitecore, webpages developing workflow start with the Layout which defines the overall structure of a page. Within the layout, there are multiple Renderings. We create them separately for reusability purposes on other types of pages. We place renderings into a layout using a Placeholder that defines the location of a rendering on the page.

Data Templates

The content structure for the renderings is setup using data templates. Each field has its own type, such as an image or text. Sitecore is able to correctly generate the corresponding HTML output for each type. Data templates act as a model that will bind to renderings to display the values from the fields in Sitecore.

The project, Feature, and Foundation Layers

Visual Studio Folders Structure

Folders Structures

  • Create the same folders physically on your drive under the projects folder you created in the first step. Under the project name of your solution, create a Source folder then, inside it, create the 3 folders: Project, Feature, and Foundation. Make sure no other folders exist (i.e. the default project created by Visual studio etc….)
  • Following Helix principles, projects within your solution must adhere to the following structure:
  • Project naming convention: [Solution name].[Project Layer].[Project Name]. So for example, if you create a solution named Demo and you want to create the configuration project for it, then the full name will be as following: Demo.Foundation.Configuration.
  • Also, you should save physically this project as follows:
  • Under your solution folder, go to the Foundation folder. Create a new folder and name it Configuration. Inside it, create a new folder and name it code. Then you can save your project there. The Final Path will be:

Helix Structure Benefits

One of the main benefits of Helix Structure is that when you do a change in the code, this action will affect only the related project and not the whole solution. Also, Helix Structure creates a standard approach for organizing projects which makes the structure more predictable for future updates and enhancement processes.

Project settings

Regardless of the layer or the functionality, for any new project created under your Sitecore solution, please consider the following:

  • When you create a new MVC project, make sure to delete all unnecessary folders and files: App_Data, App_Start, Content, fonts, etc….
  • For any new project except the Configuration project under the foundation layer, make sure that the web.config both in the webroot and under Views folder are not deployable to avoid breaking the main Sitecore installation. To do that, right-click your web.config and set Build Action to None, and set Copy to Output Directory to Do not copy.

Sitecore Kernel and Sitecore MVC

  • Under the Feature layer, your projects will need to install Sitecore Kernel and Sitecore MVC. You can do that by using the NuGet Package Manager (NPM). Right-click your project, select Manage NuGet Packages. You must have Sitecore Package Source saved there. If not, click Settings, add the new name, and the source URL which is:

Managing Dependencies using Helix Principles

Following Helix principles, we have 3 layers as discussed: From the top we have, Projects, Features then Foundation. The Dependency flow goes on the same way from Top to Bottom and NEVER the opposite. Based on that: A project under the Project layer can reference other projects in the Foundation or the Feature layers. The same, a project in the Feature layer can reference others in Foundation BUT NEVER from the Project layer. Also, a project cannot reference from another one on the same layer.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store