[Radiant] RFC: Alias Behavior

Brian Gernhardt benji at silverinsanity.com
Thu Dec 28 08:35:23 CST 2006


I just hacked together a dirt-simple "alias" behavior.  This came out  
of a desire to have a second domain serve up a portion of the main  
site (using the Virtual Domain Behavior).  All it does is take the  
"source" page part and use that to find (by slug) another page to  
use.  It allows children of the original page to be overridden by  
children of the alias page.

http://silverinsanity.com/~benji/radiant/alias_behavior.rb

To use it, just place the above file in RAILS_ROOT/app/behaviors

As a note, "find_page_by_path" seems like it would be generically  
useful, especially in environments where the page URLs are very  
different from the page slugs.  (Along with <r:if_page path=""> and  
<r:unless_page>, which would check to see if the current page matches  
a slug path.  I'll write those up when/if I need them.)

If anyone has any questions or comments, feel free to let me know.   
If you spot any glaring errors, PLEASE let me know.  I'd like to have  
people more familiar with Radiant's core take a peek at it before  
trying to use it in a production environment.

(BTW, is mental stable enough for production use and is there an easy  
migration path from 0.5.2 yet?)

Thanks,
~~ Brian



More information about the Radiant mailing list