The use-case for this situation is that I want to use the $name of the item to populate a text field for CSS class. Example:


Since this is for a CSS class, I want it to be lowercase, but I'm not sure if this is possible.

1 Answer 1


Yes, but not OOTB. You would need to roll a custom token. Maybe something like $namelower.

To do this you would extend the ExpandInitialFieldValueProcessor

Here is an example:

using Sitecore.Diagnostics;
using Sitecore.Pipelines.ExpandInitialFieldValue;

namespace CustomExpandTokenProcessors.Pipelines
  public class CustomTokenReplacer : ExpandInitialFieldValueProcessor
    private const string Token = "$customtoken";

    public override void Process(ExpandInitialFieldValueArgs args)
      Assert.ArgumentNotNull(args, "args");

      args.Result = args.TargetItem.Name.ToLower();

You can add your own code in there to set the result of the token expansion.

Then you would need to patch this in like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <processor type="CustomExpandTokenProcessors.Pipelines.MyCustomTokenReplacer, CustomExpandTokenProcessors" patch:after="processor[@type='type=Sitecore.Pipelines.ExpandInitialFieldValue.ReplaceVariables, Sitecore.Kernel']"/>

Source of all this goodness is @soren.engel (https://soen.ghost.io/working-with-custom-tokens-in-sitecore/)

  • Although Richard's answer is correct and I have no idea about your requirement but you can use this content (your class name with Uppercase) in back end by converting it in lowercase. Jun 20, 2018 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.