Cache indirect output of Sitecore controls

CONTEXT

In my previous post I’ve described solution that allow you to inject scripts and styles in a 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.

Continue reading “Cache indirect output of Sitecore controls”

Cache indirect output of Sitecore controls

Require JS and CSS for a Sitecore components

Context

According to HTML best practices and guidelines we need to put styles in head (so that they would be applied to html immediately after rendering) and scripts in 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 component, which could require some styles on specific scripts, and put them in a placeholder in the middle of the page.

This results in two common solutions: small scripts and style section spread all over the page, added in each component, or huge styles and scripts files containing all required content and added according to guidelines.

There should be a better way, lets see how it looks.

Continue reading “Require JS and CSS for a Sitecore components”

Require JS and CSS for a Sitecore components

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

Context

When you working in Experience Editor (previously Page Editor) it is quite difficult to understand hierarchy of controls and their relation one to each other, moreover it is not always clear where your control ends and placeholder starts.
Why not to add some wrappers around controls? Lets see how we can do this.

Continue reading “Render wrapper around components in Experience Editor (aka Page Editor)”

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

Sitecore: using MVC areas

Sitecore out of the box will not provide MVC ares support but you will really need this functionality for good solution organization. However, Sitecore has good pipelines system and you could plug you code that will resolve areas. Continue reading “Sitecore: using MVC areas”

Sitecore: using MVC areas

Sitecore: MVC fallback device

Implementation of layout fallback device in Sitecore MVC

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

Sitecore: MVC fallback device