Monday, 13 November 2017

Sitecore Experience Accelerator :: SXA :: Using Page list Component to Display :: Articles Sorted by Custom Date ::

Let's assume that we have a requirement to build the news component which is similar to shown below.

Basic Business Case was to get the news article sorted by their publishing date.

Alright, let's start some action.

  1. All the news items are stored under /sitecore/content/TEN/WEBSITE/Home/news
  2. Create an item query  /sitecore/content/TEN/WEBSITE/Settings/Item Queries/NewsSortedByDate as shown below
I have used build query mechanism 

template:{Your Template Id};sort:news-published-date

Cool now in Page List Component use the item query in order to list the data as shown below.

The index should be updated in order to have relevant and correct data. Default rendering list the data in list view.

We can use rendering variant in order to customize the look and feel as per business need.

Happy Sitecore SXA.

Monday, 30 October 2017

Sitecore Experience Accelerator :: Restrict the Search Result only for Given Template :: Search Result Component

In case you are in love in SXA and using the Search result component in order to display the result.

Here are quick notes before you start.

Fist and foremost you need to Enable the Lucene or  Solr Search configuration so we can go ahead and index the data.

By Default, all the template which inherits from _searchable is getting displayed in  the

search result.

However, we had a requirement to limit for only given template type so only those search result is displayed.

Cool, this can be achieved using SXA in build scope setting as shown below.

Happy Sitecore SXA.

Wednesday, 25 October 2017

How to call the Subscribe Mail Chimp API from C#

I wanted to do MailChimp subscription. I wanted to do using C# so I did a quick google and get Reference of below Code.

Here are the Steps:

Create one Mail Chimp Account and get the API Key 

Get the list ID as shown below;

using System;
using System.IO;
using System.Net;
using Newtonsoft.Json;
using System.Diagnostics;

namespace MailChimpConfiguration
    class Program
        static void Main(string[] args)
            var apiKey = "-us17"; // your API key here
            var listId = ""; // your list ID here
            var subscribeRequest = new
                apikey = apiKey,
                id = listId,
                email = new
                    email = ""
                double_optin = true,
            var requestJson = JsonConvert.SerializeObject(subscribeRequest);

            var responseString = CallMailChimpApi("lists/subscribe.json", requestJson);
            dynamic responseObject = JsonConvert.DeserializeObject(responseString);
            if (( != null) && (responseObject.euid != null))
                // successful!
                string name =;
                if (name == "List_AlreadySubscribed")
                    Trace.TraceInformation("Mailchimp already subscribed");
                    Trace.TraceError("Mailchimp subscribe error {0}", responseObject.error);


        private static string CallMailChimpApi(string method, string requestJson)
            var endpoint = String.Format("https://{0}{1}", "us17", method);
            var wc = new WebClient();
                return wc.UploadString(endpoint, requestJson);
            catch (WebException we)
                using (var sr = new StreamReader(we.Response.GetResponseStream()))
                    return sr.ReadToEnd();

Credit : 

Tuesday, 5 September 2017

How to install Sitecore Experience accelerator SXA Learning Site "ShowCase"

What is ShowCase for Sitecore Experience Accelerator.?

What Habitat is for Helix; Showcase is for Sitecore Experience Accelerator.

The showcase was originally created by Cognifide for Zen Garden - a product that later evolved into Sitecore Experience Accelerator. And is currently passionately maintained by Adam Najmanowicz

Here are the Steps in order to do Set up for Showcase.

The Latest cut of Showcase can clone or downloaded from Sitecore Showcase

In my case, I have downloaded the same @ C:\projects\Showcase\Sitecore.XA.Showcase

Launch the Visual Studio with Administrative privileges and open the Solution.

Update the showcase folder in Sitecore.XA.Project.Showcase.User.Config depending upon the location you have cloned the Git Solution as shown below.

Rebuild the Solution and Publish the solution to Root of  Sitecore Instance.In my case it was

C:\inetpub\wwwroot\sitecoresxa\Website as shown below

If all goes fine then go to your Sitecore Instance and Login as Admin.

Now goto http://<yourSitecoreinstancename>/unicorn.aspx

Sync in order to install all the Sitecore item.

If all went fine you can see a tenant called showcase and a site called int as shown below

I found some cosmetic issue while accessing in preview mode.

When connnect Sitecore SXA community over Sitecore SXA Slack  Adam replied that the current Git version is not compatible with version 4 and have provided compatible package as given below!AmgGEEfpMIP2hqBVhOmhFoFGbVzsCg

Voila all fine as shown below

Happy Sitecore Experience Acceleration.                        

Saturday, 2 September 2017

How to Use Login and Logout in Sitecore Experience Accelerator SXA

Open the Sitecore in experience Editor Mode and add login in the Main section while log out rendering in Header section as shown below.

Add the Associated items(Login and Logout)  under given item path as shown below.


These data source items are useful in order to customise the label, Error Message and Redirection Url post successful login as shown below.



Alright look like all set; let's see how its works in preview mode.  Voila, it works perfectly fine as shown below.


Isn't it too easy?                                                                                                                                  

Yes, It is very straight forward  However I am pretty much sure you must be having the similar question How to get this working with custom login provider or with federated authentications, etc.

Alright time to do deep dive to find the clue the crux is here.                                                                  

My deep love with latest crush Sitecore SXA continues  :)                                                                   

Happy Sitecore Experience Acceleration.                                                                                           

Thursday, 31 August 2017

How to use Twitter in Sitecore Experience Accelerator SXA 200th Blog

Almost 4 years back I wanted to maintain online diary where I can augment all my Sitecore learning and think of writing blogs so it helps me along with the world wide Sitecore community.

Here comes my first welcome blog  Learning Sitecore CMS Welcome Blog.

Time went like a rocket and did not realize me this current blog post is special and it's 200th blog post for Learning Sitecore CMS.

In today Session I will be covering how to use Twitter in Sitecore Experience Accelerator.

To start with first create one twitter application in Twitter Application Management 

Go to Keys and Access Token and You should be ready with below.

  • Consumer Key (API Key)
  • Consumer Secret (API Secret)
  • Access Token
  • Access Token Secret
Oh, Enough we can't wait for any further without launching Sitecore Launch Pad.

Alright lets Launch Sitecore                                                                                                                  

Open the Experience Editor Mode and add the Twitter Component.

Use existing or New associated content; In my case, I am choosing an existing component as shown below.

The item path for the existing item for me   was as below.                                                                                                                                                       /sitecore/content/PradeepNewtenant/myllandingpage/Data/Twitters/MyTwitter

The actual setting of items is as shown below.

The twitter app credentials need to be augmented @

 /sitecore/content/PradeepNewtenant/myllandingpage/Settings/Twitter Apps/Pradeep Twitter App

All done time to see the results.

It works as shown below.

My deep love with my latest crush is Sitecore SXA continues  :)

Happy Sitecore Experience Acceleration.

Tuesday, 29 August 2017

Fixing the Error While Installing Sitecore 8.2 Complete Set Up : The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=

I face one unexpected issue while installing Sitecore 8.2 using Sitecore 8.2 rev. 160729.exe

I will say unexpected because I have used the same installer in order to install the Sitecore Complete Instance at least 10 times.

The Error is as below

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Source Error:

Line 10: @model Sitecore.Mvc.Presentation.RenderingModel
Line 11: @{
Line 12:   var rendering = Html.Sitecore().Controls().
Line 13:   rendering.Class = "sc-launchpad";
Line 14:   

Source File: c:\inetpub\wwwroot\Habitat\Website\sitecore\shell\client\Applications\LaunchPad\Layouts\Renderings\LaunchBar.cshtml    Line: 12 

As the Error is clearly saying  You must add the Reference to 'System.Runtime

I copied the System.Runtime.dll from below location

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades

to Bin folder of Sitecore Instance; In my case it was


It was relaxed feeling when I saw launchpad screen back

Happy Sitecore

How to use Google Map in Sitecore Experience Accelerator

 Add a Google Map Rendering as shown below

Try to use existing or new content as per need

When we preview you get the below OOPS message.

In order to fix this issue, we need to provide Map Provider setting as shown below.

Voila, finally we got something rendered.

But life always needs more and is always demanding I want to display Dubai as location.We can update map item in order to get the desired results as shown below.

 Hurray all set I am all set now.

I am in deep love with my latest crush is Sitecore SXA. :)

Monday, 28 August 2017

How to use Image in Sitecore Experience Accelerator

Open the experience editor mode as shown below

Click in the header section of the grid as shown below.

Add an image rendering as shown below.

Select the associated content from existing content or create a new one

Click on choose an image

You can upload a new image.
From Existing media library.

Now open the site in preview mode as shown below

Voila all done

I am in deep love with my latest crush is Sitecore SXA. :)