Posts

Using React components in Sitecore

Image
  PROBLEM BACKGROUND Do you need to incorporate a React component into Sitecore?   Is your team using SXA or a similar technology which provides out of the box components that your building your site with?   Are you NOT using Sitecore JSS / headless yet?  We are developing a new site in Sitecore 10.  We wanted any component that interacts with our CRM data to be written in React.   We are NOT using Sitecore JSS but we are using Sitecore SXA.  The question becomes,  how can we incorporate a new Sitecore rendering that will use React as the front end technlogy.  How will we get the rendering and datasource parameters successfully passed down to the React component? One approach I've seen on several Sitecore sites, blog posts, etc is to use ReactJS.Net.    That solution works but feels like overkill to include a React component.   You get to maintain ReactJS.Net components in your solution, You need to have javascript engines on your server and in your local solution to allow for ser

Always enforcing your sites single language in Sitecore

PROBLEM BACKGROUND Do you have a sitecore website that will exist in only one language? Have you checked what will happen if someone accesses your site passing the query string parameter sc_lang where sc_lang is set to a value your site doesn't support?   Your site might throw a 500 error, it could redirect the user to your custom error page or it could throw a yellow screen of death. Try your site out, see what happens.      You might be wondering why would this ever happen? I became aware of this issue when one of our designers tried to pass an unsupported language to the sc_lang parameter to see what would happen.   Our site redirected the user to our error page, showing no content. We all know malicious users exist.  If they find you are running a Sitecore instance, they can try to pass query string parameters to your site to see what happens. If they get the ysod they might get useful information. POTENTIAL RESOLUTION Keep in mind, Sitecore is working as des

Handling the situation where scItemPath does not exist in Sitecore MVC

What happens if the scItemPath specified in your route does not exist in Sitecore? In this post i'm going to discuss how I handle this situation. Here is a sample route from Sitecore's MVC documentation .   (see Section 4.1) // matches the item '/home/blogPosts/{blogNo}' routes.MapRoute("example2", "blog/{blogNo}", new { scItemPath = "/home/blogPosts/{blogNo}" }); But what happens when the blog number doesn't exist?   What page will Sitecore show?  What if the user has a link to an old blog post that you have archived or someone links to a blog post using the wrong number by accident? What I wanted was a new route value that specified where to go when the path resolved by scItemPath is not found.  So I created the scNoItemFound value. // matches the item '/home/blogPosts/{blogNo}' routes.MapRoute("example2", "blog/{blogNo}", new { scItemPath = "/

Why I chose Selenium WebDriver instead of Telerik's free testing framework

Telerik Testing Framework vs Selenium WebDriver In this post I will discuss why I chose  Selenium WebDriver instead of Telerik's Free Testing Framework . We are a Microsoft shop using C# and usually the latest version of Visual Studio.  I'm using nUnit because our build tool Bamboo easily intergrates with nUnit. Telerik Testing Framework Information First I want to say I love Telerik components.  My organization owns Telerik's Dev Craft suite and we use components from almost each toolkit.   Their components and support are wonderful.  I would recommend you check them out if you are in the market for high quality .NET components. The one component I am not using from the Telerik suite is their free testing framework .    Their testing framework allows you to automate web and wpf user interface testing.    The API is very rich as it has went through several iterations.   When you install the testing framework it gives you nice Visual Studio templates

Using Sitecore.Logging to send emails

BACKGROUND In this post I will show you how to send an email using the Sitecore.Logging namespace. If you want to get straight to the code here you go ! PROBLEM WE NEED TO SOLVE Do you need to send emails when something happens in your Sitecore website?  For example, if you get a critical error and want to email this to a distribution list?       Using Sitecore.Diagnostics you can log this error to the Sitecore log, but you still need that email sent to get someone working on the issue asap! Many solutions exist to fit this need.  You can use System.Net, you can use nLog or a plethora of other logging systems. But why not use what you already have with Sitecore?    Sitecore went ahead and wrapped up the log4net code inside their own dll,  Sitecore.Logging.dll.    You can use your favorite .NET decompiler to look at the code.    I use Telerik's Just Decompile to look under the hood of the Sitecore.Logging.dll.   Remember, adding another dll to the application domain take

Conditional caching components in Sitecore MVC

Image
I'm writing this post to help remember why I chose a particular solution and to hopefully help anyone else in the same scenario. I will start off by stating the problem I needed to solve, a couple options I reviewed and why I chose a particular solution.  We are using Sitecore 7.0 and since Sitecore 7.0 requires ASP.NET MVC 3 we are using ASP.NET MVC 3.   We are also using Glass Mapper and love it :-). PROBLEM:    Users came to me with a late requirement.  They want the ability to add renderings above and below an items content.   The renderings they want must access the database each time they are rendered to show accurate data. How can we efficiently handle this situation without making major changes to the current design? BACKGROUND:    Our items are made from a template that has four sections.  (Other sections exist but for this discussion these sections are the only ones relevant).   Each section consists of the following fields,  Content ,  Active  and  Style .

I'm in love with MODx

BACKGROUND By day I am a .NET developer writing C# windows and web applications.    I very much enjoy the .NET space.    My professional experience with a CMS tool has been with Sitecore.  I have the certifications and scars to prove my expertise :-).    I am impressed with how Sitecore works and how it works for my company. By night I do websites for small businesses helping them achieve a web presence with limited budgets.  Enter the open source space. I have created sites in Joomla, Wordpress and Wild Apricot CMS tools.   I have played with Umbraco as well but most small businesses already have a hosting presence and it is on a linux host.   That closes the door to the .NET space.   No worries, I enjoy working with all technologies. DRUPAL IS EASY, FUN, PRODUCTIVE? I recently started working on a simple site for a client.   They had approximately 15 pages of static html to put into a CMS tool. The layout of each page was a simple two column layout, where the width