Protect Your Sitecore Renderings From Bad Datasources

We’ve all been there before, you get the urgent email off hours, or the call while you’re sleeping. “The site is down!  Our homepage is not coming up!” You go to check and sure enough, the error handler page is displaying when you hit the homepage.  Checking the logs, you see your old friend, “Object reference not set to an instance of an object.”

There are many reasons why a rendering can get published with an invalid or missing datasource.  The datasource could still be stuck in workflow, but the page it was added to was approved and published. A content editor may have set a publishing restriction on the datasource, setting up content in advance to be published at a certain date dictated by the business.  Perhaps the datasource was created in English, but the site is multilingual and no version in Spanish exists.

There are strategies to handle each of these scenarios, but content editors are always finding ways to do unexpected things.  A Sitecore developer needs to write code that can handle these situations gracefully, without bringing down the page or emitting malformed HTML.  However, checking in every rendering for null or invalid datasources can become tedious.  This is ideally handled in a base class that your renderings inherit from. Continue reading “Protect Your Sitecore Renderings From Bad Datasources”

Sitecore Microsites Made Easy

A couple months ago I wrote a blog post detailing a microsite implementation we built for a client. The implementation uses a custom site resolver and content-specific configuration to allow new sites to be created and deployed without configuration updates or deployments.  That post was picked up by Sitecore’s technical blog, and can be read here: https://www.sitecore.net/learn/blogs/technical-blogs/chris-sulham/posts/2015/01/quick-guide.aspx

My friend Pete, around the same time, released a module that accomplishes this in a more robust way, essentially upgrading the way you manage sites in a Sitecore solution.  Pete’s module is worth considering if you need a more holistic solution to site management within Sitecore.  Check out Pete’s module on the marketplace, and the source on GitHub.

Adding Flickr Images to Sitecore Content

This past weekend I participated in the Sitecore Hackathon along with a few other people here at Velir.  My teammates (@distaula, @soyburgers) and I decided to build a tool that would allow content editors to embed media from external sources into their rich text areas.  We chose Flickr to start with due to its popularity with our clients and its accessible API, via the Flickr.NET library. Continue reading “Adding Flickr Images to Sitecore Content”