Sitecore supports content tree structure when you create items and I’m currently working for a client where we need to sync more than ten thousand articles(articles to Sitecore items, using Data Exchange Framework for syncing) to Sitecore and what if  we have million articles  and tree structure is not recommended way if you have more articles.


  • Supports large data
  •  Automatically organizes content items into a folder structure that improves database retrieval performance(year/date/month/..)
  • You can queries against an index, ensuring high performance.
  • You can find whenever you want quickly by using free text search, facets and search filters


You’ll loose human readable url’s and url will be clumsy

name/solution/2017/01/25//10/15/14/19/item name

Customizing Bucket Url’s :

I found below code is very useful and working when I integrate with my solution

Creating Custom Bucket URL
using System;
using System.Linq;
using Sitecore;
using Sitecore.Buckets.Managers;
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.SearchTypes;
using Sitecore.Pipelines.HttpRequest;

namespace CustomBucketUrl
  public class CustomItemResolver : HttpRequestProcessor
    public override void Process(HttpRequestArgs args)
      if (Context.Item == null)
        var requestUrl = args.Url.ItemPath;

        // remove last element from path and see if resulting path
is a bucket
        var index = requestUrl.LastIndexOf('/');
        if (index > 0)
          var bucketPath = requestUrl.Substring(0, index);
          var bucketItem = args.GetItem(bucketPath);

          if (bucketItem != null && BucketManager.IsBucket(bucketItem))
            var itemName = requestUrl.Substring(index + 1);

            // locate item in bucket by name
            using (var searchContext = 
ContentSearchManager.GetIndex(bucketItem as IIndexable)
              var result = searchContext
x => x.Name == itemName).FirstOrDefault();
              if(result != null)
                Context.Item = result.GetItem();

Creating Custom Link Manager:

using System;
using Sitecore.Buckets.Managers;
using Sitecore.Buckets.Extensions;
using Sitecore.Links;
using Sitecore.IO;

namespace CustomBucketUrl
  public class CustomLinkManager : LinkProvider
    public override string GetItemUrl(Sitecore.Data.Items.Item item,
UrlOptions options)
      if (BucketManager.IsItemContainedWithinBucket(item))
        var bucketItem = item.GetParentBucketItemOrParent();
        if (bucketItem != null && bucketItem.IsABucket())
          var bucketUrl = base.GetItemUrl(bucketItem, options);
            return FileUtil.MakePath(bucketUrl, item.Name);

      return base.GetItemUrl(item, options);

Creating custom pipelines to make a call to your code:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="">
        <processor patch:after="
type="CustomBucketUrl.CustomItemResolver, CustomBucketUrl" />
        <add name="sitecore">
          <patch:attribute name="type">
CustomBucketUrl.CustomLinkManager, CustomBucketUrl</patch:attribute>

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Fake DB

How to do unit testing for media items in Sitecore + xUnit testing : Fake DB

Unit testing in Sitecore is a tricky one since you need create an items in Fake dB. I didn’t find much information about Media items unit testing and below piece of code may help you! Read more…

Fake DB

PageContext item in Sitecore Fake DB + Unit test cases

I tried to set PageContext using  RenderingContext.EnterContext but didn’t work using (RenderingContext.EnterContext(new Rendering(), contextItem)) { I have set it using  ContextService.Get().Push(pageContext); Here is the code, which may help you using (Db db = new Db using (Db Read more…

Sitecore 8.2

Mocking a reference field in Sitecore Fake DB for Unit test cases

I’m working on Unit test cases and mocking a reference field could be a complex task. Here is the code, which may help you [Fact] public void ReferenceFieldMockingTest() { ID newTemplateId = ID.NewID; ID referenceItemId Read more…