We have a requirement where in every time a new CT is created we need to add some TBBs (like config and cleanup etc done by us) into the CT. Is there a way to save us from doing this every time and instead must use TBBs would be automatically populated in the CT once new CT is selected (something similar to Tridion default TBBs which are added to a new CT)

  • It's hard to imagine a system that needs to have all its templates so similar. At some point, your programmers are going to have to do some work. This will either be in creating templates, or in sorting out all the cruft later on. Aug 4, 2013 at 9:33

1 Answer 1


There are two really simple ways of doing it, that I can quickly come up with:

  1. Create a Compound Template Building Block (like the Default Finish Actions) which contains all your "defaults". This would still require some manual work of adding that one of course. (a variant of this would be to add your TBBs to the Default Finish Actions, unless your TBBs should be before the DWT TBBs that is).

  2. Create a Master Template CT and in here put all your often used TBBs. Don't link any Schema for this CT and leave it like that (because there is no Schema linked, it is in nobodies way and can act as a "template"). Now when you need a new Component Template, make a copy of this one, rename it and start working with it.

The third option is to create an event system (link requires login) using the LoadEventArgs and EventPhases.Initiated phase. Here you will need to check if you are working on the initial version of the item and then insert the TBBs.

The event system code would look something like this:

public class EventHandler : TcmExtension
    public EventHandler()
        EventSystem.Subscribe<ComponentTemplate, LoadEventArgs>(ComponentTemplateCreate, EventPhases.Initiated);

    private static void ComponentTemplateCreate(ComponentTemplate ct, LoadEventArgs args, EventPhases phase)
        if (ct.Version != 0) { return; }

        // add your TBBs here


Not 100% sure about the version check in there, if that works etc. and you need to figure out the rest regarding adding of TBBs...

Personally I would go for option #2 I think, simple and efficient. If you opt for option #3, then I would still create the "template CT"and copy its contents in the Event System. That way you don't have to make code changes when you want a different set of defaults.

  • 1
    +1 to #2 as a "prototyped" approach with good defaults. I recommend the same for authors in the CME (copy a page you like), but Experience Manager and even before, SiteEdit, did the same with page types. Aug 2, 2013 at 19:38

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.