Design & Technology October 02, 2014
DD4T: 'Losing Control' of the HTML
The introduction of DD4T (also known as Dynamic Delivery for Tridion) to the SDL Tridion world was a great day for developers and release managers. It provided a friendly developer experience, abstracted from Tridion, and also allowed for better release to production processes.
Now, when looking at new projects, instead of asking, “should we use DD4T?”, we find ourselves asking “is there a reason why we shouldn’t use DD4T?”
Recently, one of those reasons reared its head.
“We want to be able to control the HTML, like we do now, from within Tridion using the Razor Mediator”
Digging a little deeper into the requirement, we discovered that the customer wanted to control the HTML of the Component Presentations from the Tridion interface, to enable their marketing team to react to their customers and make quick changes, without having to involve IT. They didn’t need to control the HTML at a page level. This meant that DD4T was still an option worth exploring, with an overlooked approach described below.
DD4T allows developers and intern editors to add both DD4T style Component Presentations, using the out of the box DD4T templates, as well as traditional statically rendered Component Presentations to the same page.
It is very simple; to add a traditional, statically-rendered Component Presentation, follow the same basic steps as per a standard Tridion implementation
- Create (or re-use) a Schema
- Create a Component Template:a. Use the “Page/Component Template metadata” Schema to target the Component Template in your DD4T Page Layout later.
b. Mark the Component Template as “Publish Embedded on a Page”
c. Write out HTML in the normal way with your preferred templating type
- Link the Schema and Component Template
- Create content Components based on your Schema
- Update your DD4T Page Layout to output the static Component Presentation in the desired location(s), for example:
- Add a Component Presentation to your DD4T page(s), with the content and new static Component Template
- Publish your page
Now you will have the ability to manage (and quickly update) your HTML within the Tridion interface, while having the benefits of running a DD4T web application.