[Radiant] [PREVIEW] Snapshot extension: serve Radiant sitesstatically

Daniel Sheppard daniels at thegroggysquirrel.com
Sun Oct 28 20:04:48 CDT 2007


>      I'm glad that the extension is useful.  I take note of 
> the virtual page
> problem you comment and will look at it before releasing the 
> first official
> version of the extension.
> 
>      I don't have experience with virtual pages so may be i 
> ask you for
> support.  A good opportunity to learn more, indeed.

Basically, you'd need to extend virtual pages to be able to return
a list of urls at which they may be rendered. For example, the
ArchiveYearIndex virtual page would need to define something like:

def valid_urls
  first = parent.children.find(:first, :order => 'updated_at').updated_at.year
  last = parent.children.find(:first, :order => 'updated_at').updated_at.year
  (first..last).map {|year|
    "#{parent.url}/#{year}/"
  }
end

And then you could render each of those (the first and last calculations there
are a little primitive, look at my admin_tree_children extension for better calcs).

Then you just render each of those urls.

(the same logic would also be useful for cache-clearing when those pages are 
edited).

Dan.



More information about the Radiant mailing list