Nathaniel,

I think overriding Page#find_by_url for the /blog page would be the answer. In the override (which I would probably add with alias_method_chain), I would do two things:

1) Attempt to find the page normally by calling the overridden method.
2) If the normal find_by_url returns nil or a FileNotFoundPage, attempt to find the page by slug as a child of the /blog/archive page (more precisely, select the ArchivePage from /blog's children, then find among its children by slug, excluding virtual pages). If this returns nothing, then pass through nil or the FileNotFoundPage; otherwise return the found grandchild page.

Hope that gets you going in the right direction.

Sean

Nathaniel Talbott wrote:
I have a client who wants to shorten the blog permalinks on their site from:

  http://example.com/blog/archive/2008/05/31/my-blog-post

To:

  http://example.com/blog/my-blog-post

The blog is set up in the standard Radiant manner, and I'm scratching
my head over how to get these links working how they'd like them to. A
few requirements: /blog/archives should still be an archive page, and
/blog still needs to show the most recent five posts (and thus I don't
think it can be the archive page itself).

Any pointers on the simplest way to get this working? If I need to
write a some custom tags that's fine, but I wanted to make sure I'm
not missing a simpler solution first.

TIA!



_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to