Comments on: Better Search Engine Friendly URL’s with Ruby on Rails http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/ It's Just Links Wed, 14 Sep 2011 13:47:04 +0000 http://wordpress.org/?v=2.9.1 hourly 1 By: Harlow http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/comment-page-1/#comment-8596 Harlow Tue, 10 Apr 2007 06:41:51 +0000 http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/#comment-8596 Sorry made a typo: And in the view: link_to @client.name, client_url(:permalink => @client.permalink) Sorry made a typo:
And in the view: link_to @client.name, client_url(:permalink => @client.permalink)

]]>
By: Harlow http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/comment-page-1/#comment-8595 Harlow Tue, 10 Apr 2007 06:40:01 +0000 http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/#comment-8595 I feel like the id-words-words is a bit of an ugly solution. I get that its easy and will satisfy most. However if you are representing clients names then the user should not have to remember the ID. I.E. if you were talking to someone and said "go to mydomain.com and type /apple" as opposed to "go to mydomain.com and type /1233-apple" I've found the map.something_custom in the routes.rb file to be a much nicer solution: map.client 'client/:permalink', :controller => 'test', :action => 'show', :permalink => '' Then in the controller: @client = Client.find_by_permalink(params[:permalink]) And in the view: link_to @client.name, show_client(:permalink => @client.permalink) This way you have full customization over the url paths, and still retain permalink functionality. Write a little AJAX on the input form and you can generate/and validate URLs. This is really nice because you don't always need the whole title of your post in the URL. I feel like the id-words-words is a bit of an ugly solution. I get that its easy and will satisfy most.

However if you are representing clients names then the user should not have to remember the ID. I.E. if you were talking to someone and said “go to mydomain.com and type /apple” as opposed to “go to mydomain.com and type /1233-apple”

I’ve found the map.something_custom in the routes.rb file to be a much nicer solution:

map.client ‘client/:permalink’, :controller => ‘test’, :action => ’show’, :permalink => ”

Then in the controller: @client = Client.find_by_permalink(params[:permalink])

And in the view: link_to @client.name, show_client(:permalink => @client.permalink)

This way you have full customization over the url paths, and still retain permalink functionality. Write a little AJAX on the input form and you can generate/and validate URLs. This is really nice because you don’t always need the whole title of your post in the URL.

]]>
By: Jack http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/comment-page-1/#comment-6978 Jack Thu, 29 Mar 2007 02:42:17 +0000 http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/#comment-6978 How about http://chrisfarms.googlecode.com/svn/rails/plugins/acts_as_friendly_param/README Known as Acts_As_Friendly_Param How about http://chrisfarms.googlecode.com/svn/rails/plugins/acts_as_friendly_param/README

Known as Acts_As_Friendly_Param

]]>
By: tony http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/comment-page-1/#comment-4023 tony Wed, 28 Feb 2007 01:30:34 +0000 http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/#comment-4023 Without a doubt chrisfarm's is the perfect solution and so easy! Well done mate. I just installed the plugin and was up and running in seconds. Without a doubt chrisfarm’s is the perfect solution and so easy! Well done mate. I just installed the plugin and was up and running in seconds.

]]>
By: Stancell http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/comment-page-1/#comment-3675 Stancell Fri, 23 Feb 2007 13:55:37 +0000 http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/#comment-3675 Chrisfarms solution is better than permalink_fu cause it allows to change url. After renaming "Apple Computer" to "Apple Inc." /companies/7-apple-computer would change to /companies/7-apple-inc /companies/7-apple-computer would return a 301 (permanent) redirect to /companies/7-apple-inc and that is the way it should be. Chrisfarms solution is better than permalink_fu cause it allows to change url.

After renaming “Apple Computer” to “Apple Inc.”
/companies/7-apple-computer would change to /companies/7-apple-inc

/companies/7-apple-computer would return a 301 (permanent) redirect to /companies/7-apple-inc and that is the way it should be.

]]>
By: chrisfarms http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/comment-page-1/#comment-3140 chrisfarms Thu, 15 Feb 2007 19:24:55 +0000 http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/#comment-3140 @tony: I took yours and Obie advice/idea into account and stoped the multiple page issue.... hope you find it useful http://www.chrisfarms.com/2007/2/11/seo-friendly-urls-in-rails @tony: I took yours and Obie advice/idea into account and stoped the multiple page issue…. hope you find it useful

http://www.chrisfarms.com/2007/2/11/seo-friendly-urls-in-rails

]]>
By: tony http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/comment-page-1/#comment-2529 tony Sun, 04 Feb 2007 21:13:31 +0000 http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/#comment-2529 Hey Obie, That would still be a bad thing for SEO as it would result in multiple, indexable pages with exactly duplicate content. Hey Obie,
That would still be a bad thing for SEO as it would result in multiple, indexable pages with exactly duplicate content.

]]>
By: Obie Fernandez http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/comment-page-1/#comment-2528 Obie Fernandez Sun, 04 Feb 2007 20:44:44 +0000 http://www.tonyspencer.com/2007/02/04/better-search-engine-friendly-urls-with-ruby-on-rails/#comment-2528 Hey Tony, thanks for the acknowledgement, and here's one quick point that I should have emphasized -- because the significant part of the URL is the numerical id (and the textual part of the slug is ignored when pulling up a resource), then even if the name was changed in the future, the original URL would still work perfectly with old links. Hey Tony, thanks for the acknowledgement, and here’s one quick point that I should have emphasized — because the significant part of the URL is the numerical id (and the textual part of the slug is ignored when pulling up a resource), then even if the name was changed in the future, the original URL would still work perfectly with old links.

]]>