All in the <head> – Ponderings and code by Drew McLellan –

Keeping Your Content Classy

In User Generated Content in a Classy World Snook muses on the problems of keeping tight control over styling (and by extension, markup) without either embedding too much presentation into your stored content or having to write janky CSS that becomes hard to manage.

In an ideal world, a CMS would allow you to define and embed “objects” inside the content. An object has some complexity to it. For example, a pull quote might have a byline. A photo might have a caption and a credit. Or maybe it’s even more complex than that.

A little over a year ago, we added a feature into Perch to work exactly like this. We call our objects ‘blocks’, and they enable a content editor to compose an item of content from pre-composed elements defined by the web designer. You can see a quick overview video of how our Blocks feature works below.


The key point here is that the content and the template markup are completely independant of one another. The content is stored in the database, and the markup lives solely in the template.

Your pull quote might have a byline, but the markup for it is stored with the template, not the content. That template might change tomorrow when a new version of HTML introduces a byline element, or you rewrite your CSS. You might also choose to display that same content elsewhere on your site with a different template for a different context, or publish the content in an HTML email where you need to use crufty 1990s table layouts.

None of that can happen if you bake classes into your content.

As someone who designs content management systems, what {{content}} says to me is here be dragons. It’s a sign that your CMS has given up managing content and is leaving you to fight your own corner. It no longer has your back. It’s every man and woman for themselves. I don’t accept that as a good solution, and neither should you.