Posts

Showing posts from September, 2018

Adding dynamic image source for multi-site solutions with $site$ token and setting dynamic datasource location for components

Image
Months after finishing a project I have had clients saying: We need to make a copy of the site you created and put some other content on it Most clients need to put this new site into the same solution because of restrictions in their Sitecore license. To convert old projects there was usually a lot of content restructuring and code changes needed. I have done this exercise multiple times. I try to have this in mind when creating new solutions so we don`t end up with too much effort when adding support for multi sites at a later stage. Even with great structure and code we still face some problems. In a multi-site solution you want to reuse components, but the sites should not always share the data locations and image folders. Most sites have different editors, they should not see the components and images from the other sites, we then need to place content in different folders and set the appropriate security on those. I recently got a request to duplicate an existing site,

Step by step guide to add Glass Mapper to Helix solution

Image
How to add Glass Mapper to Sitecore Helix solution There are probably different ways to set this up in a Helix solution. I have done this setup in 4 of our projects, and it has become the "template" for our new Helix solutions. We create one foundation project, which has all the glass nuget packages installed, we also choose to add a glass base in the foundation layer. All new features will have access to this glass base interface through a project reference.  I have had a lot of discussions with my co workers on where to add common fields that would be used in several feature projects. If it should be in the Glass Mapper foundation project or in a new foundation project. On "small" projects we choose to add it in the Glass Mapper foundation project, on larger projects we created a separate foundation project to add these fields and their interfaces with Glass Mapper mapping. 1. Create the Visual studio project From the Package Manager Console run

Step by step guide to add Serialization project to an "empty" Sitecore Helix solution

Image
In this blog post I will give a step by step guide to add a Serialization project to an "empty" Sitecore Helix solution. I created a guide to setup a clean Helix solution in this blog post . I will add a Serialization project into this solution In my projects I usually have a simple template for Foundation projects and another template for Features. The Feature will have references to Glass Mapper, extensions and more. If you want to have different templates for Foundation and Feature projects look at my previous blog  post  for an example on how to get you started. The steps 1. Run the command Add-Foundation Serialization (Package Manager Console) 2. Add unicorn to the project from Nuget  3. Unicorn.UI.DeployedContentEditorWarnings.config.disabled This file configures Unicorn to throw up warnings and prompts when saving items that are included by Unicorn. On CM servers we would like this to be enabled. For Sitecore 9 this will be enabled correc

Step by step guide to setup a new Sitecore Helix solution without Gulp

Image
Habitat and Helix Habitat is an example on how you can set up a Sitecore Helix solution. I have seen several projects using it as a starter. Habitat is not intended to be a starter solution, or as a recommendation of tools for your solutions. https://github.com/Sitecore/Habitat I created some notes and steps in notepad while setting up my first and second Helix project. I shared these notes with my team members and it has been used as a way to start new Helix solutions for our team. Setup new Sitecore Helix Solution 1, Install site  For Sitecore 8 use SIM . For Sitecore 9 install site with install.ps1. 2. Create a new project in Visual Studio Online 3. Clone the project 4. Create empty solution 5. Add your Sitecore .gitignore This is my starter .gitignore. 6. Add nuget.config 7. Add  "empty" node-templates for feature, foundation and project These will be extended as the solution grows. My starter node templates on GitHub . Feature