This is an old thread that I have been meaning to follow up. Sean suggested:

that one
should focus on the _why_ you need an uncached page in the first
place, and address that need first


I created a route:

   map.with_options(:controller => 'site') do |site|
     site.connect 'store-directory/:name', :action => 'show_page',
:url => '/store-directory/store'

This captures URL's like these:


A better solution would be to create a new model called StorePage, inheriting from Radiant's Page model. You can override the find_by_url method, so that the StorePage would behave as an 'index' page, or a 'show' page. For example:

        Would be an index page, listing all your stores

        These would be 'show' pages, for individual stores.

You would only need to create a single StorePage in your Radiant sitemap. In the above example, this would have the slug 'store- directory'. Each of the sub-pages, corresponding to individual Store models, would exist as 'virtual pages'. You won't see them in the sitemap of the Radiant admin, but they exist on the public facing site.

If you use this approach, you don't need to create any custom routes. The index/show pages would both be rendered using the SiteController#show_page action. This should mean that caching works just as you would expect. So the /store-directory page and /store- directory/carlton-cards pages would be cached without interfering with each other.

Here is an example of a model that overrides the page model:

Note the tags: <movies:if_index/> and <movies:unless_index/>. The content for the index page should go inside the if_index tag, and the content for the 'show' pages should go inside the unless_index block.

I hope this helps clear things up.

Radiant mailing list

Reply via email to