Home

Awesome

Sitecore-ItemNamingRules

Getting Started

The ItemNamingRules project provides conditions and actions for the rules engine to automate item name conventions. You can use the ItemNamingRules project to apply different item naming rules in different branches of the content tree. For more information about the rules engine, see the Rules Engine Cookbook.

With the provided conditions, you can:

With the provided actions, you can:

For example, you can configure an item naming rule such that if an item descends from the /sitecore/content item, and that item has layout details, then the name of the item must contain only lowercase letters, numbers, and underscores, cannot contain two sequential underscores, cannot begin or end with an underscore, cannot exceed 35 characters, and must not have any siblings with a common key. The ItemNamingRules project automatically renames the item, appending a datestamp if required to ensure unique keys.

You can use additional techniques to meet specific objectives when controlling item names. You can configure the InvalidItemNameChars, ItemNameValidation, and MaxItemNameLength settings in web.config, but these settings apply to all items rather than to items matching specific criteria. You can use pipelines to interact with CMS users when they invoke operations that affect item names, prompting the user to correct errors instead of correcting them automatically. You can also use validation including validation actions to flag and correct naming issues.

Note: The ItemNamingRules project will not rename standard values items, or the home item of any of the managed Web sites.

Installation

The provided package $(SolutionDir)\release\ItemNamingRules.Sitecore.Master.update was created using Team Development for Sitecore and is supported with Sitecore 6.1-7. Navigate to http://yoursite/sitecore/admin/updateinstallationwizard.aspx and install the package.

Configuration

Two rule conditions have been provided. For instructions to use either of these conditions in a rule, see the Rules Engine Cookbook.

Four rule actions have been provided. For instructions to use these actions in a rule, see the Rules Engine Cookbook.

To manage item naming rules, in the Content Editor, select the /sitecore/system/Settings/Rules/Item Saved/Rules item. Insert rule definition items using the System/Rules/Rule data template. In the Rule field, click Edit Field, then select conditions, then add actions (in the order listed), and then enter parameters for the conditions and actions:

Credits

This code was provided by John West via

The starting point for this code was taken from the Marketplace with no functional modifications. This includes any changes that were outlined in the comments here. The provided code was turned into a proper Visual Studio solution and installation package by Sean Kearney.