Say bye to /articles/read/5

Posted by tobi — 06:50 PM Apr 02

Typo just got good looking permanent urls!

so instead of

http://blog.leetsoft.com/articles/read/25

we now have

http://blog.leetsoft.com/articles/2005/03/28/round-corners

nifty huh?

For good measure its also possible to list all posts done in month of February by going to http://blog.leetsoft.com/articles/2005/02 or all posts of 2005 by http://blog.leetsoft.com/articles/2005.

Here are the two routes which make it all possible:


  # allow neat perma urls
  map.connect 'articles/:year/:month/:day', :controller  => 'articles', 
            :action => 'find_by_date', 
            :year => /\d{4}/, :day => nil, :month => nil
  map.connect 'articles/:year/:month/:day/:title', :controller  => 'articles', 
            :action => 'permalink', :year => /\d{4}/

Comments

  • True Alex 27 Jun 09:39

    Thnx! it’s useful article!

Commenting are now closed…