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 and must be referenced in the field of the rendering definition item. Now when Sitecore is loading a view rendering, it starts the pipeline to create an instance of the referenced model and passes the model to the view. By default Sitecore creates the model instance with , which means that the class needs a default constructor and doesn’t allow constructor injection. John…

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…

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…

Keep reading »

Extend the Sitecore HtmlHelper

When you work with Sitecore MVC you usually also work with Razor as your view engine. To support you in your Razor views, ASP.NET MVC has a number of useful helper methods (e.g. to generate a form). These methods are part of the class and are invoked with . Sitecore has it’s own html helper, available with . You may know the following method to output the content of a Sitecore field, including inline editing for the Experience Editor: Sometimes you need more functionalities and you wish you…

Keep reading »

Enforce language version presence for items in Sitecore 8.1

In a multi-language solution all the Sitecore items have different versions in different languages. Depending on your configuration, you can load the items by adding a language parameter in the url, e.g.: Now what happens when only has a language version in English, but not in German? Right, this usually should result in a 404 (page not found) error message. But it doesn’t out-of-the-box. Check the following code: This means, Sitecore always returns an item, also when there is no language…

Keep reading »