Require JS and CSS for a Sitecore components

According to HTML best practices and guidelines, we need to put styles in the head (so that they would be applied to HTML immediately after rendering) and scripts at the end of body (so that they will not block your browser from downloading other content). On the other hand for Sitecore, you need to create a component, which could require some styles on specific scripts, and put them in a placeholder in the middle of the page....

May 19, 2015 · 4 min · Alex Smagin

Render wrapper around components in Experience Editor (aka Page Editor)

When you working in Experience Editor (previously Page Editor) it is quite difficult to understand the hierarchy of controls and their relation to each other, moreover, it is not always clear where your control ends and placeholder starts. Why not add some wrappers around controls? Let’s see how we can do this. Approach We need to create a pipeline processor that will inject some markup around the component if the page is in editing mode....

May 18, 2015 · 3 min · Alex Smagin

Sitecore Continuous Integration

Usually, during the standard process of development, you would have several environments like DEV, QA, UAT/STAGING, and so on. The more environments you have - the more cases and differences in deployment you will need to implement. In this post, I would try to describe how you could simplify your life implementing CI for Sitecore based projects. Solution Almost immediately you would face a question of content synchronizations. There are a lot of options that you could use:...

September 25, 2014 · 3 min · Alex Smagin

Sitecore: extending field datasource queries with tokens,

It is quite a common situation when you need to create a data source query for a field in a template that is quite complex: e.g you would like to use the current item property as a part of a query or you have a dependency on some other item in a content tree. Implementaiton In the case of list fields, you could use GetLookupSourceItems pipelines to modify query according to your requirements....

June 22, 2014 · 2 min · Alex Smagin

Sitecore: multisite solution organization

Reading Sitecore manuals or digging in the Internet you probably see a following statement: “Information Architecture is very important for Sitecore solution”. So I would like to share some thoughts and approached. Nowadays I’m mainly working with MVC and this post is also about it, but a lot of stuff could apply to WebForms as well. Design Projects organization in solution It doesn’t matter whether you working with a multi- or single-site project, you should always treat it as multi-site, as your customer will ask you one day to add something and you should be ready for this kind of request....

June 15, 2014 · 3 min · Alex Smagin

Sitecore: using MVC areas

Sitecore out of the box will not provide MVC areas support but you will need this functionality for good solution organization. However, Sitecore has a good pipeline system and you could plug your code that will resolve areas. Implementation You need to apply area detection only to** controllers renderings**, as Controllers will require areas information in order to resolve views for example. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 { using System; using Sitecore....

June 13, 2014 · 3 min · Alex Smagin

Sitecore: logging via RabbitMQ

In previous post I’ve described why I’ve started to look into RabbitMQ integration. Here you could find its implementation. Implementation: Sitecore + RabbitMQ To send log data from Sitecore we need to extend its Logger. Sitecore uses a logging system based on log4net (it is their implementation and based not on the latest log4net sources) so we could try to use existing open-source module from NuGet at least as a reference....

May 27, 2014 · 1 min · Alex Smagin

Sitecore: Logging with EKL (ElasticSearch+Logstash+Kibana)

Why not to use standard files? Usually, when you are working with Sitecore you will have standard file-based logs. For development, this is more than enough but when it comes to other environments it could be very nice to have all logs centralized. Moreover need to be sure that logs are not lost in cases when something went wrong and it is easy to find information in it. So my goal is to create a solution base on EKL (ElasticSearch+Logstash+Kibana) which will get log data from Sitecore and provide possibilities to search and work with them....

May 27, 2014 · 2 min · Alex Smagin

Sitecore: Round Image Processor

When you are creating a marketing site with a lot of visuals on it very likely that you will need to process images that you need to display. Fortunately, Sitecore provides you with some basic operations that you would need like resize or grayscale image. Moreover, it will think about caching images on the server-side after processing, so that processing of the image for a specific page will happen only once (for more information about images parameters see this link)....

May 21, 2014 · 3 min · Alex Smagin

Sitecore: MVC fallback device

Sometimes when you creating mobile versions of a site, you could decide to show some page from the desktop version and do not create the mobile layout for them (e.g. they are less important than other pages or not visited frequently). Sitecore has a setting for that called Fallback Device. However, when you are working with the MVC layout it is not really working. A nice moment over here is that it is really easy to enable it....

May 15, 2014 · 2 min · Alex Smagin

Sitecore: Solr spell check

During one of our projects, we faced a problem that Sitecore 7 does not support out of the box some cool features of Solr like spell check and similar results, which were in great demand on one of our projects. After some time of investigation with Reflector, we found out that this kind of customization would not be easy, as a lot of classes in Sitecore provider to Solr wasn’t designed to support third party customization....

May 15, 2014 · 10 min · Alex Smagin