Radiant CMS for Rails Developers

Posted on September 16th, 2007 by Chris

I recently ported an existing Rails site to the Radiant CMS as our client wanted changes more frequently that initially anticipated. The good news is that the port went well. Radiant is a nice system. But I did struggle just a wee-bit. So, as I typically don’t do front-end stuff at Bust Out, I figured I would take the opportunity to post a few things about what I went through from the perspective of a Rails developer accustomed to controlling my own destiny vis-a-vis MVC/Erb, rather than letting a CMS do it for me.

I’ll start with the layout. Our Erb layout looked like the following:



<%= yield :layout %>
<%= render :partial => “/layouts/footer” %>

We’re setting the body class dynamically to highlight page navigation. The yield and render partial statements should look familiar to anyone with a working knowledge of Rails.

Now lets look at the Radiant version of the above, which uses the Radiant tagging system:



Radiant provides a number of different ways to generate content, the predominant methods being creating layouts, snippets and pages. In Radiant, our partials become shared snippets, our yield statement is replaced by a content tag, and our sidebar is replaced by a page content part (created in the pages tab) that is inherited by all child pages and can likewise be overridden by child pages with different sidebar content. Lastly, we’re using a Radiant tag that infers the title of the current page being navigated to in order to drive the “where am I” functionality of our header navigation.

A relatively simplistic example, but hopefully somewhat illuminating. In the next post, I’ll discuss creating pages and some more dynamic content. In the meantime, we encourage anyone looking for a nice clean ruby CMS to give Radiant a try. Cheers!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Write a new comment


Comment: