# Archive extension without the dates in the URL

**URL:** <https://www.ruby-forum.com/t/archive-extension-without-the-dates-in-the-url/121247>\
**Category:** Radiant CMS\
**Created:** [November 26, 2007, 1:32am UTC](https://www.ruby-forum.com/t/archive-extension-without-the-dates-in-the-url/121247 "2007-11-26T01:32:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewkendall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b77776/32.png) [@andrewkendall](https://www.ruby-forum.com/u/andrewkendall)\
**Post date:** [November 26, 2007, 1:32am UTC](https://www.ruby-forum.com/t/archive-extension-without-the-dates-in-the-url/121247/1 "2007-11-26T01:32:20Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![andrewkendall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b77776/32.png) [@andrewkendall](https://www.ruby-forum.com/u/andrewkendall)\
**Post date:** [November 26, 2007, 10:22am UTC](https://www.ruby-forum.com/t/archive-extension-without-the-dates-in-the-url/121247/2 "2007-11-26T10:22:22Z")

</div>

±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,

---

<div class="post-metadata">

**Author:** ![andrewkendall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b77776/32.png) [@andrewkendall](https://www.ruby-forum.com/u/andrewkendall)\
**Post date:** [November 26, 2007, 2:31pm UTC](https://www.ruby-forum.com/t/archive-extension-without-the-dates-in-the-url/121247/3 "2007-11-26T14:31:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![andrewkendall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b77776/32.png) [@andrewkendall](https://www.ruby-forum.com/u/andrewkendall)\
**Post date:** [November 26, 2007, 11:44pm UTC](https://www.ruby-forum.com/t/archive-extension-without-the-dates-in-the-url/121247/4 "2007-11-26T23:44:39Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![andrewkendall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b77776/32.png) [@andrewkendall](https://www.ruby-forum.com/u/andrewkendall)\
**Post date:** [November 28, 2007, 2:58pm UTC](https://www.ruby-forum.com/t/archive-extension-without-the-dates-in-the-url/121247/5 "2007-11-28T14:58:19Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![andrewkendall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b77776/32.png) [@andrewkendall](https://www.ruby-forum.com/u/andrewkendall)\
**Post date:** [November 29, 2007, 1:30am UTC](https://www.ruby-forum.com/t/archive-extension-without-the-dates-in-the-url/121247/6 "2007-11-29T01:30:37Z")

</div>

> 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.
