404notfound

Handling 404 in a Sitecore multisite solution and avoid 302 redirects

This post shows how to handle a request for a page which is not found, how to avoid having the request being redirected with a 302 status code before a 404 and finally how to use different pages within Sitecore for not found pages in a multisite solution. The post is based on some code I wrote back in June 2012 and I have seen the concept used several places since then so a lot of you will know it already and might already have it implemented yourselves in some form. ...

February 10, 2014 · 6 min · alc
awesomechat

SignalR component for SPEAK in Sitecore 7.1

Following my blog post from earlier this week where I showed how to make SignalR work in Sitecore SPEAK, I thought of another solution to the same issue which is much more streamlined with SPEAK. The issue which I hacked my way through was that the RequireJS implementation in SPEAK requires that a JavaScript file ends with .js if it does not then .js will be added automatically. ...

February 3, 2014 · 6 min · alc

Custom Field indexing with the new Sitecore 7 content search API

Sitecore 7 comes with it’s new Content Search API. The title of this post is self explanatory for what i’m about to share. Scenario I assume I have a website that contains information about different publishers books. These books are imported into Sitecore in XML format. I assume that on the website a user should be able to find content from these documents by performing a search. So I want to create an index that will index the contents of these books. Later I want to perform searches on Authors, Book names, Publishers, and clear text. A possibility is to index the pages of the books separately, so when the results are returned you know not only the book where the specific word or phrase has been found but also the exact page. ...

February 1, 2014 · 4 min · ap
speaklist

Setting up a Sitecore SPEAK ListControl

The ListControl in SPEAK is made as a generic control for showing lists. Data is fed into the list using a datasource component as shown in my previous post here. In this post I will show how to define the columns in a ListControl and setup the rendering on a SPEAK page. It is kind of similar to how it was done in the “old” version of SPEAK which has been used for ECM 2 (as one of the only concepts which has been kept in the new version). ...

January 27, 2014 · 3 min · alc
json

Creating a simple Sitecore SPEAK JSON datasource

In SPEAK a list is fed with data through a data source. For example to get data into a ListControl the Items rendering parameter on the ListControl has to be bound to a collection on a datasource. When the items model attribute changes, that is when the datasource changes, then the ListControl automatically refreshes and shows the new data. SPEAK ships with 3 different data sources which are all made for Sitecore items. ...

January 26, 2014 · 4 min · alc

Using SignalR in a Sitecore 7.1 SPEAK application

During the Sitecore Hackathon we decided to implement a chat app for Sitecore editors so it is possible to send text messages to other online editors. To do this we wanted to use SignalR and SPEAK for the UI part. Setting up SignalR and creating the SPEAK layout was done quickly but it quickly became obvious that using the two together could be trickier than anticipated. The issue was not with SPEAK itself or SignalR but with RequireJS and the order in which Javascript is loaded. ...

January 26, 2014 · 3 min · alc
nested hell

Nesting if statements

This post is not only about Sitecore development it is valid for any code written in almost any language. It is about making code easier to read. The post is somewhat subjective but I hope that all developers with an IQ higher than 80 will agree. Back in the days when I learned to write code I could end up writing something like this: public void SomeMethod(string args) { if (args != null) var something = args.Something; if (something != null) { var someResult = DoSomethingWithSomething(something); if (someResult != null) { IGotMyResult(someResult); } } } But what I was doing back then was actually turning things upside down, writing “stay with me” instead of saying no right away, making the code less readable for other developers. ...

January 12, 2014 · 2 min · alc

Profiling your Sitecore code using ProfileSection

Just a quick tip for profiling your custom code in Sitecore. Over the years I have seen many different approaches used for measuring and logging the time it takes to execute a block of code. Many of these quite unnecessary since Sitecore already has this functionality built in. Sitecore has a lot of very useful methods for this in the Sitecore.Diagnostics namespace which unfortunately I seldom see used by partners. ...

January 9, 2014 · 2 min · alc

Using threshold warning limits in Sitecore

When working on an old Sitecore solution the log files are almost always completely spammed with different threshold warnings. 744 10:28:14 WARN Item threshold exceeded for web page. Items accessed: 2578. Threshold: 2000. Page URL: /xxxx.aspx 7672 10:28:15 WARN Item threshold exceeded for web page. Items accessed: 29145. Threshold: 2000. Page URL:xxxx.aspx 7672 10:28:15 WARN Memory threshold exceeded for web page. Memory used: 37813KB. Threshold: 35000KB. Page URL:xxxx.aspx This is of course if you have not changed the threshold warning limits in configuration or turned off the threshold warnings completely which is only possible from version 6.4. ...

January 8, 2014 · 3 min · alc
bestpractice

Should be Sitecore best practices

During my work at Pentia I often perform health checks of existing Sitecore solutions built by other Sitecore partners. The solutions vary a lot in both quality and age but there are a few things which I need to point out as missing in each and every report. It is like it is secret Sitecore features only known by a small group of privileged developers even though it is so extremely basic. ...

January 6, 2014 · 5 min · alc