Monday, May 18, 2015

Breadcrumbs for pages in Sitecore

Breadcrumbs will generally start with the home page followed, by each level of the site architecture and ending in the current item. Therefore in this example, the breadcrumbs will always have the home item (linked to the home page) and the current item (with no link). The logic required is filling in the missing pieces (the structure in between home and current item).

In the code above there is a simple breadcrumb object which contains a list of parent items and the current item's title. On the front end you simply output the home item in the sublayout, set the current item's titleand using a repeater, loop through the parent items to display their title as a hyperlink. Items.ContentRootItem is a resources file string containing the GUID for the root item, we are looping through the parents until we hit this item.


  1. Hi may i know the references you are using in this code

    1. The following references are used:

      using Sitecore.Data;
      using Sitecore.Data.Items;
      using System;
      using System.Collections.Generic;
      using System.Data;
      using System.Linq;

    2. Hi ryan follow up question i still can't resolve the issue on Items.ContentRootItem and Common.MenuItem. I've tried hardcoding the id of home item but i still can't resolve the issue on Common.MenuItem

      Thanks for your help

    3. Items.ContentRootItem is the GUID of the parent item (Home) in Sitecore, I am storing it inside a resources file as a string.

      The post has been updated to contain the menu item class.