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

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 HtmlHelper class and are invoked with @Html.MethodToCall(). Sitecore has it's own html helper, available with @Html.Sitecore().MethodToCall(). You may know the following method to output the content of a Sitecore field, including inline editing for the Experience Editor: @Html.Sitecore().Field("My Field"…

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.: English: http://mysite/en/myitem German: http://mysite/de/myitem Now what happens when myitem 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: var language = Sitecore.Context.Language; // = de var item = Sitecore.Context.…

Keep reading

New in Sitecore 8.1: MVC Areas

Since Sitecore 6.6 we have the possibility to implement our Sitecore solutions with ASP.net MVC. There are a lot of features from pure MVC available in Sitecore, but one important feature (especially when working in a multi-site setup) is missing: The support for MVC areas. At my SUGCON presentation earlier this year, I could mention that Sitecore is working on something. This blog post now gives you an overview what Sitecore has added into version 8.1 to support MVC areas out-of-the-box. How it works For each MVC…

Keep reading

Test your Fast Queries with Sitecore.FakeDb

During the last few months I was very busy with my Master Thesis. Now the project is almost finish and I can spend more time on my blog and helping in the community. Yay! While implementing my project for the Master Thesis I’ve learned a lot about Unit Testing with Sitecore and I realised how easy and fast you can write them. This blog post should show you in a very simple example how you can test your Sitecore Fast Queries. When you decide not to use the Sitecore…

Keep reading