How to Configure Item Bucket Paths in Sitecore CMS

April 9, 2015

Blog | Development | How to Configure Item Bucket Paths in Sitecore CMS
How to Configure Item Bucket Paths in Sitecore CMS

This is the 25th in a series of posts about learning how to use and develop for Sitecore CMS, and the follow-up post to “How to Show Item Bucket Paths in Sitecore CMS”.

In this post I will cover how to configure item bucket paths. By default, item buckets use a path based on the item’s creation date that follows a year/month/day/hour/minute format. Configuring the path allows items to be accessed in a logical manner.

For example, with articles that are published on a daily basis, you might want a path like articles/year/month/day/article-name. With events that occur a few times a month, you might want a path like events/year/month/event-name. With tags that are arranged alphabetically, you might want a path like tags/e/example.

Note:

This tutorial will make use of the item bucket created in “How to Create Item Buckets in Sitecore CMS”.

To change the path that an item bucket uses, first select the /sitecore/system/Settings/Buckets/Item Buckets Settings item.

Click the “Edit Rule” button above the “Rules for Resolving the Bucket Folder Path” field to open the “Rule Set Editor” modal.

The Rule Set Editor is made of three panels. The top left panel is the available bucket conditions. Conditions can be selected to determine when a rule will apply. The top right panel is the available bucket actions. Actions can be selected to determine how the path will be generated. The bottom panel is the “Rule description” panel, which displays the overview of the selected conditions and actions.

In this example we will be making listing page buckets use a year/month/day format, so select the condition that says “where the item bucket is based on the specific template”.

A new rule will have been added to the “Rule description” panel at the bottom.

Click the “Edit” button on “Rule 1” to change its name to “Listing Page”:

The condition that we added to the listing page rule has two clauses. The first clause is the “where” link. Clicking on the link toggles the clause from “where” to “except where”. In this case we will leave the “where” clause alone.

The second clause is the “specific” link. Clicking on the link opens a “Select Item” modal which can be used to select the desired template. Select the “Listing Page” template in the modal and click OK.

Now we want to add an action to set the path. Click the “create the folder structure based on the creation date of the new bucketable item in this format” action.

The new action will have been added to the “Listing Page” rule. This action only has a single clause, which is the “this” link.

Clicking on the link opens a prompt to enter the format to use for the date. The default date format is yyyy/MM/dd/HH/mm. Change this to yyyy/MM/dd and click OK in the prompt.

Click OK in the “Rule Set Editor” modal and save the changes.

Navigate to /sitecore/content/Example/Home/Articles, and note that existing items will still be using the old format of year/month/day/hours/minutes.

To fix the existing items, click the “Sync” button in the “Buckets” section of the “Configure” tab.


As always, if you have any questions, or if there’s something you’d like to see covered, drop us a line.

Tim Leverett

Senior Developer
Tags
  • Sitecore

Recent Work

Check out what else we've been working on