I have a relatively static site. I also have a fairly generic CT with many default and custom TBB's. I add new DWT Layout TBBs and use the same CT with just swapping out name and TCM ID of the new layout TBB. Now I have a large number of CT's where the only difference between them is the layout TBB. There has to be a better way.

I'm looking for an idea on how to add that "Layout" TBB dynamically based on the Component name or ID.

  • My understanding you are looking to find and replace existing CompoundTemplate TBBs to new TBB "Layout" by programmatically Is that correct?
    – Velmurugan
    Mar 5, 2019 at 11:49
  • Yes, I'd like to use the same CT and programmatically change the dwt layout TBB.
    – fondofhats
    Mar 5, 2019 at 21:40
  • then, It's possible to use core service to change the compound template TBBs XML programmatically to add the new TBB to replace existing TBB, using tridion core service you can query and get all the compound templates and process the XML to find and replace
    – Velmurugan
    Mar 5, 2019 at 21:48

1 Answer 1


You could use something like the Razor Mediator Helpers and Functions, or build your own templating mediator to handle this, but I wouldn’t advise it.

In my opinion (I’m happy to be corrected), I think you’d be adding significant complexity for not much gain (how long does the copy, paste and update take?).

Also, as well as giving you the TBBs (including your layout TBB), the Component Template also allows you to specify which Schemas that can be used with that template, and to give the CT a sensible name for the editors. You could lose both of these with a more ‘dynamic’ approach.

  • Thanks for sharing. Very valid points. Honestly, I just wasn't sure if there was a standard that I was missing.
    – fondofhats
    Mar 5, 2019 at 21:43
  • Glad the additional points were helpful. It’s better to ask these question. As you say, sometimes it’s not entirely obvious when there’s a better way of doing things in Tridion. Mar 5, 2019 at 22:03

Your Answer

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

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