First ever Sitecore Technical User Group Event in Jaipur by SUGJPR

SUGJPR happy to announce our first upcoming event on Saturday, November 19th, 2016 from 2.00 PM – 6.00 pm. Venue – Hotel Sarovar Portico Vaishali nagar, Jaipur



  • Sitecore® Experience Platform™ – How you can own experience -Explore the power of Sitecore and learn Features, Uses of Sitecore and how it is better then other CMSs.
  • Getting started with Sitecore – Building A Very Simple Website – Basic of Sitecore installation, configuration and tuning of Sitecore in .NET environment, design and implement templates & layouts for a very simple website.
  • Sitecore Experience Accelerator (SXA) -A set of toolings and processes to allow the rapid creation of websites by increasing the amount of work that can be done in parallel.

schedule Details- 

  • 2:00PM – 2:15PM – Welcome/Registration
  • 2:15PM – 2:30PM – Introduction
  • 2.30PM – 3:15PM – Presentation – Introduction to Sitecore® Experience Platform™
  • 3.15PM – 3:30PM – Break
  • 3:30PM – 4:15PM – Presentation -Getting started with Sitecore – Building A Very Simple Website
  • 4:15PM – 4:45PM – Snacks and Tea
  • 4:45PM – 6:00PM – Presentation -Sitecore Experience Accelerator (SXA)

Please join us  –

If you have any questions. Please contact us –

  • email –
  • Mahendra – +91 92525 82898
  • Gaurav – +91 80581 54358
  • Office – 0141-2358028

Resolve Wildcard (*) Item

In one of our #Sitecore project we have requirement that we need to keep Events at a common place outside the Home node. So we thought to keep them in common Globals Folder. Now the biggest challenge is that how to resolve these events.

From where we got an idea of wildcard item (*). This is the Sitecore structure.

  • sitecore
    • content
      • SiteItem1
        • Home
          • Event Landing Page
            • *
        • Globals
          • Site Setting Item
          • Event Folder
            • Event Detail Page1
            • Event Detail Page2

So according to this structure we have #Wildcard Item(*) under home node. It is like event detail page that is under Event landing page.




And in Globals folder we have all events, those are actual Event Detail Pages, we need to resolve.



Also you can see that I have created a Site Setting Item, in which I have some settings as you can see below image –




On site setting item I have 2 fields –

  1. Event Calendar Root
  2. Fallback Events Detail Page


Okay, Its time for code now. First of all I have created a custom LinkProvider.config. That is as follows –

<?xml version=”1.0″?>
<configuration xmlns:patch=””&gt;
<processor type=”, Sitecore.EventCalendar” />
<patch:attribute name=”defaultProvider”>fullcalendar</patch:attribute>
<add name=”sitecore”>
<patch:attribute name=”name”>fullcalendar</patch:attribute>
<patch:attribute name=”type”>, Sitecore.EventCalendar</patch:attribute>
<patch:attribute name=”lowercaseUrls”>true</patch:attribute>
<patch:attribute name=”languageEmbedding”>never</patch:attribute>


As you can see in this LinkProvider.config, I have created a pipeline named overrideItemUrl and then created a defaultprovider. So first talk about defaultprovioder. I have created a provider with the name “xyz”, in which I am calling a class “LinkProvider“. The code for this LinkProvider is here –


public class LinkProvider : Sitecore.Links.LinkProvider
public override string GetItemUrl(Item item, UrlOptions options)
var args = new WildcardItemUrlArgs(item, options)
BaseAction = base.GetItemUrl

CorePipeline.Run(“overrideItemUrl”, args);

if (args.HasOverride && !string.IsNullOrEmpty(args.Url))
return args.Url;

return base.GetItemUrl(item, options);

public override UrlOptions GetDefaultUrlOptions()
var urlOptions = base.GetDefaultUrlOptions();
urlOptions.SiteResolving = Settings.Rendering.SiteResolving;
return urlOptions;


Basically Linkprovider is used to resolve links. So I am overriding its default method GetItemUrl, in which I am calling another method that is “WildcardItemUrlArgs”.


public class WildcardItemUrlArgs : PipelineArgs
public WildcardItemUrlArgs(Item item, UrlOptions urlOptions)
Item = item;
UrlOptions = urlOptions;

public Item Item { get; private set; }
public UrlOptions UrlOptions { get; private set; }
public string Url { get; set; }
public bool HasOverride { get; set; }
public Func<Item, UrlOptions, string> BaseAction { get; set; }


Then I am calling overrideItemUrl pipeline, as you can see in LinkProvider class.


<processor type=”,” />


So now in overrideItemUrl pipeline I am calling a processor.

So now in EventUrlOverride class –


public class EventUrlOverride : BaseUrlOverride
public void Process(WildcardItemUrlArgs args)
if (args.HasOverride || !args.Item.InheritsTemplate(“Event Detail Page Template ID”) || Sitecore.Context.Item == null)

var settingItem = Sitecore.Context.Database.GetItem(“Site Setting item id”);
if (settingItem != null)
if (settingItem.Fields[“Fallback Events Detail Page”] != null && !settingItem.Fields[“Fallback Events Detail Page”].Value.IsNullOrEmpty())
var fieldId = settingItem.Fields[“Fallback Events Detail Page”].ID;

if (!fieldId.IsNull)
Item detailItem = GetWildcardDetailPage(“Event landing page template id”,

if (detailItem != null)
args.Url = GetItemUrl(detailItem, args.Item, args.UrlOptions,args);
args.HasOverride = true;


In this class I am checking the wildcard item and trying to get it by Site setting item.

As you can see I am also inheriting a class named BaseUrlOverride in EventUrlOverride class. The code of EventUrlOverride class is here –


public class BaseUrlOverride
private string GetFriendlyUrl(Item item)
return item.Name.ToLower().Replace(” “, “-“);

protected string GetItemUrl(Item detailItem, Item targetItem, UrlOptions urlOptions, WildcardItemUrlArgs args)
var friendlyUrl = GetFriendlyUrl(targetItem);
return args.BaseAction(detailItem, urlOptions)
.Replace(Constants.Wildcard.UrlToken, friendlyUrl)
.Replace(Constants.Wildcard.Node, friendlyUrl);

protected Item GetWildcardDetailPage(string landingPageTemplateId, ID fieldId, Item currentItem = null)
Item detailItem = null;

var context = Context.Item;

// Handle case where context page is either the wildcard node or landing page
if (context.Name.StartsWith(Constants.Wildcard.Node) &&
detailItem = context;
else if (context.InheritsTemplate(landingPageTemplateId))
detailItem =
.FirstOrDefault(i => i.Name.StartsWith(“*”));

if (detailItem == null)
var settingItem = Sitecore.Context.Database.GetItem(“Site setting item id”);
if (settingItem != null)
var siteLookupField = new LookupField(settingItem.Fields[fieldId]);
var selectedPage = siteLookupField.TargetItem;
if (selectedPage != null && selectedPage.Name.StartsWith(“*”))
detailItem = selectedPage;

return detailItem;


So basically in EventUrlOverride class firstly we are trying to get WildCardItem (*), then we are calling GetItemUrl method to resolve actual EventDetailPage Item.

Phewww!!! Thats it finally. Enough coding.

Happy Coding 🙂 and happy wildcard item also 🙂

Show Page Editor Message

Hi All,

In one of our project we have full page editor support. Most controls are Datasource based. So the requirement is that when there is no datasource assigned to any rendering, then we need to show a message so that anyone can identify that there is a control and they can assign datasource there. We are coding in MVC.

So for that I have created a simple Model “PageEditorModel”

namespace abc.Models
public class PageEditorModel
public string Message { get; set; }

Also created Partial View with the name “PageEditorMessage”, in which there is only message to show.

@inherits ModelView


Now its time for Sitecore. I have created Dictionary for page editor message. You can see below.


Now let’s take an example of a Rendering that is Datasource based control. In which I am checking if Datasource is null then showing PageEditor Message.

@inherits ModelView

@if (Sitecore.Mvc.Presentation.RenderingContext.Current.Rendering.DataSource.IsNullOrEmpty() && Sitecore.Context.PageMode.IsExperienceEditor)
@Html.Partial(“/renderingPath/PageEditorMessage.cshtml”, new PageEditorModel() { Message = RenderDictionaryValue(KSCVCPII.Domain.Common.DictionaryKeys.AssociateContentMessage).ToHtmlString() })
// Code here..

To render the dictionary value I have created a method. You can see below –

public IHtmlString RenderDictionaryValue(string value)
return new MvcHtmlString(HttpUtility.HtmlDecode(Sitecore.Globalization.Translate.Text(value)));


So you can see the message here in the image and you can select this rendering now and can give datasource with page editor as well.

Yes that’s all.

Happy Coding 🙂