Hello all!
I’m working on revamping my website that uses Radiant, and looking to
shake things up some. I’m looking at doing some redirects to get my site
back into some level of organization and move data into a few smaller
trees (I have 2 archives and one raw layout)
Okay, I’ve been going through the previous emails and such and
struggling a little bit. I’m looking to do a more blog-like layout but
with a little CMS on the side, and I like how Radiant works (Minus the
babysitting of a mongrel cluster under lxadmin - UNG). My issue is that
I don’t want the date in my URLs, but I like how Archive sort of works.
I was looking at Paginated Archives, but doesn’t seem to do what I want
it to do. I’m still getting used to RoR/Ruby so I don’t think I could
write something myself. Has anyone written an Archive extension without
the date in the URL/URI?
Thanks!
±Le 25/11/07 18:33 -0600, Andrew K. a dit :
| Has anyone written an Archive extension without the date in the URL/URI?
Hi,
Well, the whole point of Archive is to put dates in the URL, if you
don’t
want dates, don’t use an Archive page type but a normal page type.
Regards,
Hello again!
Well, I do feel a bit thick now: Can I use Archive Day/Month/Year Index
without having its container as Archive?
Thanks
Well, I do feel a bit thick now: Can I use Archive
Day/Month/Year Index
without having its container as Archive?
You’ll need an extension that overrides the child_url method on
ArchivePage to just return child.slug.
Should I simply duplicate the archive extension and then make these
modifications in a new extension? Or is there an alternative?
Thanks again 
Andrew (BT)
Should I simply duplicate the archive extension and then make these
modifications in a new extension? Or is there an alternative?
You can include the archive extension and then have your own extension
that
either re-opens the existing archive page type or extend archive page to
create a new page type.
class FlatArchivePage < ArchivePage
def child_url(child)
clean_url(url + ‘/’ + child.slug)
end
end
class FlatArchivePageExtension < Radiant:Extension
def activate
FlatArchivePage
end
end
Then, you just need to ensure that your extension is loaded after the
archive extension (either using the power of the alphabet, prefixing
the extensions dirs with numbers or setting config.extensions in your
environment.rb file).
Dan.