Saturday, July 10, 2010

"Set Relative DataSource" action makes total personalization effortless.

Some people say that true personalization is too complex and expensive to set up and maintain, but with Sitecore it's incredibly easy to setup personalization rules, configure rule-based content, etc. In general, to make some personalized content, you should perform the following actions:
  1. Create a personalization rule (add conditions and actions, let's say "Set DataSource" action to point personalized content folder). 
  2. Apply it to the rendering or sublayout.
While second step cannot be avoided (unless you use global rules), the first one sometimes looks redundant, as the conditions  of the most rules are very similar, especially in location-based ones. The only difference is a DataSource. The main goal of creating "SetRelativeDataSource" action is breaking such dependency and making "clicks only" personalization setup possible.

The idea is following: let the rule control only "personalized" part of the DataSource, taking the "base"  DataSource part from the control.

Let's say, you have a lot of sub-trees with personalized content for different controls:

 

Monday, July 5, 2010

Integrating SyntaxHighlighter with Sitecore's Rich Text Editor

Some time ago I've noticed that Rich Text Editor is missing "Format Code" button in it's profiles. After initial investigation, I've found that such functionality actually exists, but it's hidden for some reason. To enable it, you should  add a new button to the profile (for example, here: /sitecore/system/Settings/Html Editor Profiles/Rich Text Full/Toolbar 1) and set it's "Click" field value to "FormatCodeBlock":


If you did everything correctly, you'll get the following button in your Text Editor toolbar:



and default RadEditor's code formatting dialog


The dialog itself looks good but html it's producing is too ugly to be used at modern websites, few lines of code result in 50+ lines of markup like:

div style="BORDER-BOTTOM: #7f9db9 1px solid; BORDER-LEFT: #7f9db9 1px solid; LINE-HEIGHT: 100% !important; BACKGROUND-COLOR: white; WIDTH: 100%; FONT-FAMILY: Courier New; HEIGHT: 132px; FONT-SIZE: 11px; OVERFLOW: auto; BORDER-TOP: #7f9db9 1px solid; BORDER-RIGHT: #7f9db9 1px solid">


So, I've decided to replace it by very popular Syntax Highlighter  module. It has a lot of features, very customizable and looks really nice 

keeping the initial markup clear.