Making Config Components Disappear

Let's work some magic and make config component disappear when dealing with image/video galleries and personalized promos. We'll revisit three ways to relate content in Tridion and take a trip to see the Huizard.

Config Components are useful. We don't always need them, though.

What Galleries and Personalized Promos Have in Common

Have you ever created an image gallery or displayed related links with Tridion? Let's see how they're very similar to personalized promos,
Image Gallery. Final markup has a main image as well as related images that display according to some ordering/priority rules .
Content authors want to control:
  • The relationship between rendered items
  • The order they display, either by priority, by manually arranging a list, or both
  • A default main image, video, or fallback content
Surprisingly, an image gallery can be functionally equivalent to personalized promotional content (promos).

Personalized Promos. Final markup has either a fallback promo or related promos that display according to some ordering/priority rules .

Creating Relationship in SDL Tridion

Similar to navigation approaches, you might have created the relationship using:
  • Folders and Prefixes. Given some metadata in a given folder, you could add all related items, sorting by component titles. The folder creates the relationship, prefixes control order, and the main component may be the first item in the folder.
  • Link List. A container Component manually links to related items, which you can organize with template or presentation-side logic. The container creates the relationship, the link order creates the priority, and the main component may be the first linked item. You might have called this a {schema name} Player/Gallery, Proxy, Placeholder, Config, or maybe Query Component.
  • Taxonomy or Metadata. Presentation-side code queries appropriately tagged items (via the content delivery or CD API). Keywords create the relationship, metadata controls order (by priority, date, or some other field), but the user must somehow set a default image.
And like me, you may have seen or suggested Configuration Components that pass parameters for template logic or Content Delivery (CD)-side logic. Then TOM.NET bakes the related content or the website filters for appropriately tagged Component Presentations (CPs).

Vanishing Config Components

Eric Huiza (aka the Huizard) recently helped me simplify a functional design (and CM-side code) we were considering (in real-time, with Visio, for a client over WebEx, no less).

We call Eric "the Huizard" as a compliment and play on his "Wizard"-like abilities with technology.


When using the .NET CD API, you might pass some parameters to a tag library or control. Consider this fictional example:
<customer:ComponentPresentationQuery keyword="somevalue"
          sortorder="chronological" fallback="tcm:5-123"/>
The individual related components might have metadata, but a separate Config Component has the keywords we want to retrieve, a sortorder option, and a component link to a "fallback" item. CMS or CD-side Code retrieves the related content.

But considering we already have an item which contains metadata, skip the container with its link to a fallback and use one of the components directly on the page as a CP (or in a component link).

CD-side or template logic would then:
  • Use the component as the fallback or main item  (queued video, image, or non-personalized content)
  • Retrieve related items, by the keywords the item has itself
So instead you can use something like:
<customer:ComponentPresentationQuery runat="server" fallback="tcm:5-123"/>

What about Priority?

All we're missing is priority/sort order, which could be inferred:
  • From the schema (e.g. press releases sort by date)
  • By the presence of certain fields (e.g. if there's no date, sort by title instead), or
  • Controlled through multiple templates (e.g. Video Gallery by Date, Video by Name)

Summary (tl;dr)

Additional configuration options might really need a config component, but when possible, skip the container when you have:
  • A single main or fallback "thing" to display
  • A way to control sort order (by naming convention, some configurable relationship, or logic)
  • Presentation logic (i.e. CD API) to retrieve items with the same or related keywords. Otherwise "bake" the relationship in your template.
In the right circumstances, you can change this to a single component link or component presentation.

One last tip: if you're stuck on the config component approach, at least use an embedded schema along with Categories and Keywords to create the same set of fields for the configuration and for the actual content components.
Have a great New Year and thanks for making 2012 a little bit (a great deal) better for the SDL Tridion Technical community. May your next design session be magical, heh heh. We're not in Kansas, anymore... I'm off to see the Huizard! [Insert witty remark relating Tridion, magic, and config components]

No comments:

Post a Comment

Feel free to share your thoughts below.

Some HTML allowed including links such as: <a href="link">link text</a>.