# Template Language for a CMS

**URL:** <https://www.ruby-forum.com/t/template-language-for-a-cms/158606>\
**Category:** Rails\
**Created:** [January 25, 2009, 8:02pm UTC](https://www.ruby-forum.com/t/template-language-for-a-cms/158606 "2009-01-25T20:02:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/87869e/32.png) [@daz](https://www.ruby-forum.com/u/daz)\
**Post date:** [January 25, 2009, 8:02pm UTC](https://www.ruby-forum.com/t/template-language-for-a-cms/158606/1 "2009-01-25T20:02:19Z")

</div>

How would you go about creating a template language that could be used  
to allow access to _some_ helpers for a CMS-style app?

For example if there is a text field called content, I can use Textile  
or (my preference) Markdown to allow easy html generation, but they  
don’t allow for any conditional markup based on the page. Is there any  
way to extend these languages by allowing access to some of the helper  
methods.

I was thinking something like:

% image(bart.png) %

% breadcrumbs %

% nav\_menu(child\_pages) %

Does something like this exist? Would it be better to try to extend  
markdown or write one from scratch? How would you go about writing  
one?

cheers,

DAZ

---

<div class="post-metadata">

**Author:** ![daz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/87869e/32.png) [@daz](https://www.ruby-forum.com/u/daz)\
**Post date:** [January 25, 2009, 8:19pm UTC](https://www.ruby-forum.com/t/template-language-for-a-cms/158606/2 "2009-01-25T20:19:39Z")

</div>

DAZ wrote:

> How would you go about creating a template language that could be used  
> to allow access to _some_ helpers for a CMS-style app?
> 
> For example if there is a text field called content, I can use Textile  
> or (my preference) Markdown to allow easy html generation, but they  
> don’t allow for any conditional markup based on the page. Is there any  
> way to extend these languages by allowing access to some of the helper  
> methods.
> 
> I was thinking something like:
> 
> % image(bart.png) %
> 
> % breadcrumbs %
> 
> % nav\_menu(child\_pages) %
> 
> Does something like this exist? Would it be better to try to extend  
> markdown or write one from scratch? How would you go about writing  
> one?
> 
> cheers,
> 
> DAZ

Have you checked liquid? There is a nice screen cast @ railcasts:

> **[\#118 Liquid - RailsCasts](http://railscasts.com/episodes/118-liquid)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

---

<div class="post-metadata">

**Author:** ![daz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/87869e/32.png) [@daz](https://www.ruby-forum.com/u/daz)\
**Post date:** [January 26, 2009, 11:46am UTC](https://www.ruby-forum.com/t/template-language-for-a-cms/158606/3 "2009-01-26T11:46:23Z")

</div>

Thanks Macario,

Liquid looks like what I’m after - and the railscast (as always) is  
excellent. It seems like I could hook some specific helper methods up  
to it and they could be outputted using {{ this notation }}

Out of interest … how does one go about writing their own template  
language? Any basic way of starting?

cheers,

DAZ

On Jan 25, 7:19 pm, Macario O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
