Friday, November 11, 2011

Accessing Custom Metadata in the Content Delivery

I wanted to share some information about how to access custom metadata of different Tridion items in the Content Delivery side (AKA presentation servers).

In this post I am going to be discussing the custom metadata of the following Tridion items:

  • Component and Page
  • Component Template
  • Publication

Component and Page

Custom Metadata of both Component and Page are published to the broker. See below an example on how these can be retrieved from the presentation server.

Page custom metadata fields can be retrieved as follows...

Component custom metadata fields can be retrieved as follows...

Component Template

I was recently asked how it was possible to access Component Template's Custom Metadata in the Content Delivery side. My first thought was that it would be easily accessible, nonetheless I was wrong. 

But... after a short research on the topic, I found out that this is a well known limitation. In short, Component Template's custom metadata is not published to the presentation server, thus out of the box it is simply not accessible on the presentation server.

I have thought of a few workarounds, which is best depends on the actual requirements.
  • Adding the metadata as hidden fields in the Dreamweaver TBB
  • Create same fields in in the Component Metadata (read-only) as in the Component Template Metadata, then use the Event System to fill in these fields with the info entered in the CT custom meta, then decide in which Event this should be added.
  • In case that a framework is being used on the content delivery side. Probably, first at publishing time the component is desirialized/serialized to enrich its content, at that point the CT's metadata could be added to the component metadata. If the CT is desirialized/serialized at publishing time the custom metadata could be added as normal metadata. In any of these cases, the CT's metadata will be available  in the presentation server through either Component or Component Template.
  • Deployer Extension


Like for the Component Template, custom metadata is not published to the presentation server. I have thought of few different approaches that could be implemented in order to retrieve the publication's custom metadata on the front end.
  • Publishing the custom metadata in an XML file.
  • Creating a schema named something like "Publication Metadata", then create/localize a component when needed. Next, publish this component as a Dynamic Component Presentation with a dummy CT.
  • Deployer Extension

First of all I would like to say that I just wanted to share some knowledge and some ideas, this doesn't mean that are all great at all. I have not implemented most of the ideas mentioned in this post, and in my opinion some are far from efficient. 

That said, the more I got to think about this topic the more interested I became to know what all you out there think about this topic.

How do you usually retrieve custom metadata in the CD side from Tridion items that don't expose it out of the box?

I am sure I have a lot to learn from you, so please do not hesitate to share your opinion and/or experiences!


  1. I haven't used CT metadata much (what are we supposed to use it for?). I have a little more experience with XSLT component templates, which let you add markup similar to the DWT template building blocks. This lets you "hardcode" some items directly into the resulting component presentation (useful for things like template name or publication info, but bad for localization). This matches your first bullet for CT metadata.

    For publications, I used a cheat to get all of the publication's XML also using XSLT. (I had to double-check, but yes you can get a publication's metadata the same way). This involves a random component to publish and it doesn't need to be a dynamic component presentation.

    Now that you've posted on content delivery for a component's metadata, you'll have to cover the other sides next: given certain metadata, get the matching components as well as given a getting a component's metadata value by named key! :-)

    Excellent stuff, Asier. Thanks for sharing!

  2. Hi Asier,
    Is it possible to use the Tridion Broker API from external server that doesn't have Tridion and retrieve the data?


  3. Hi Raul,

    Sure, the only thing you need to do is to configure the web application accordingly to your environment. Tridion Content Delivery is a set of config files and DLLs that give you access to the Broker DB, that is you need to have in your website.


  4. In this case we need a new license for the external server?
    Thanks again.

  5. I don't think so, but you have customer support to ask that kind of questions ;)