Created: 2008-06-20 18:23
Updated: 2019-02-26 04:47
License: other



Merges share_layouts and nested_layouts, making the whole layout adventure a lot more enjoyable

Share Layouts


Allows Rails controllers/actions to use Radiant layouts as their "layout". content_for blocks are mapped to page parts, with the exception of :title and :breadcrumbs, which map to their specific default tags. The default content, or @content_for_layout, is mapped to the 'body' part.

Inside a controller Controller

SomeController < SiteController
  radiant_layout 'Layout name'

# or

  radiant_layout { |controller| c.action_name == "index" ? "main" : "alt" }

# and

  def delete
    @radiant_layout = 'delete'

radiant_layout takes the same options as the built-in layout. To specifically override the Radiant layout and use a standard Rails one use :layout => "mine", or :layout => false for no layout, as options to render.

To choose a different Radiant layout, set the @radiant_layout instance variable to the name of a Radiant layout in your controller or view.


  • Merged into radiant-layouts-extension, Dirk Kelly, August 2010

  • Updated to work with 0.8 RC1 by: Johannes Fahrenkrug (http://springenwerk.com), May 22, 2009

  • Created by: Sean Cribbs (seancribbs AT gmail DOT com), September 20, 2007

  • Thanks to John Long for clarifying and simplifying the process for me!

  • Thanks to xtoddx for improving the tests and support for tags that use the request and response.

  • Thanks to Digital Pulp, Inc. for funding the initial development of this extension as part of the Redken.com project.

Nested Layouts


Nested Layouts enables reuse of a top-level "master" layout (one that contains your tags and the overall structure/wrapper of your site) for several different "nested" layouts (i.e. a one-column layout and a two-column layout). Keep your layouts DRY!

A simple example is of the following wrapper and page layout

<!-- Application Layout -->
  <body class="<r:layout />">
    <r:content_for_layout />

<!-- Page Layout -->
<r:inside_layout name='Application'>

This would render the following if Page Layout was called

  <body class="<r:layout />">


Haml Layouts



Write your layouts and radius tags in haml, with support for nested layouts and radius attributes

// Parent Layout - with content/type set as 'haml'
%div{:id=>"parent",:title=>"<r:title />"}
// Child Layout - with content/type set as 'haml'

<div id="parent" title="some title">
    some title

Integrates the work of SaturnFlyer creating a haml_filter on pages and snippets. Additional task involved.

changing the order which objects with this type are renders. The content is turned into html before the radius tags are passed.


Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more