Cache indirect output of Sitecore controls

In my previous post I鈥檝e described a solution that allows you to inject scripts and styles in specific placeholders in a layout. Scripts are registered in views, but they will be rendered by global filters only when all output of a page is ready. However, when it comes to caching Sitecore will be able to record HTML generated by your component just after it is rendered. So none of the actions that will be required in other parts of the site will be triggered with cache enabled....

May 28, 2015 路 4 min 路 Alex Smagin

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鈥檚 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: 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: 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