Limit the number of components in a Sitecore placeholder

One missing feature in Sitecore is the ability to limit the number of components which can be binded to a placeholder. By default, an author can add as many components to a placeholder as he wants. But sometimes there are restrictions in the layout, where more than a specific number of components would break it. Let's say we have a teaser row to add components. In a three-column layout, the maximum of allowed teasers would be three. There are already good solutions available for this (e.g. this one here…

Keep reading

One way to implement Dependency Injection for Sitecore Habitat

Habitat is an example architecture from Sitecore. With this modular architecture, everything is encapsulated and separated into modules, where each module is a Visual Studio project. A great introduction to Habitat can be found in this blog post by Anders Laub. Encapsulation also means, that a module doesn't know other modules. When using dependency injection, you need to configure all dependencies somewhere. And this place needs to know every implementation, which is not possible with Habitat. Because each module only knows itself, only the module itself can configure its dependencies.…

Keep reading

Use Dependency Injection to resolve Sitecore View Rendering Models with Glass Mapper

In Sitecore MVC, a view rendering consists of a (Razor) view and optionally a model. The model has a definition item under /sitecore/layout/Models and must be referenced in the field Model of the rendering definition item. Now when Sitecore is loading a view rendering, it starts the pipeline mvc.getModel to create an instance of the referenced model and passes the model to the view. By default Sitecore creates the model instance with Activator.CreateInstance(), which means that the class needs a default constructor and doesn't allow constructor…

Keep reading

Sitecore MVP 2016

I am very happy to announce that I was awarded as a Sitecore Technology Most Valuable Professional (MVP) for the second time in a row. This year, Sitecore has nominated 177 Technology, 35 Digital Strategist and 9 Commerce MVPs. Thank you Sitecore for this award and the confidence in the community. It's a honour. Also I want to congratulate all the other MVPs and thank you for all your work, support and contributions. If you want to know more about the MVP program or become one yourself, check out the…

Keep reading

Item recommendations using Sitecore Content Search API

Last week it was time for the third Sitecore Hackathon. Like in the past two years, I have participated in the Team Uniques, together with Reto Hugi and Tobias Studer. We wanted to build a simple recommendation engine: It should recommend items (content) which are similar to the item the user is currently viewing. With this blog post, I want to show how you can easily build a very simple recommendation engine. Theory Without being mathematicians and studying all the complex mathematics to calculate the "perfect" recommendations, we decided to…

Keep reading