I remember reading somewhere a tip on improving your search engine ranking, by forming URLs that included relevant text, e.g. www.domain.com/article/man_eats_hat. In the rails app that I''m writing, I''ve noticed I can set this up very easily by appending the post title (after downcase.split.join(''_'')) to the post link. So, blog.com/posts/4 can easily also be blog.com/posts/4/title_of_blog, with the following added to config/routes.rb: map.connect '':controller/:action/:id/*anything'' Of course this also means that blog.com/posts/4/anything_else points to the same place, and I was wondering if this could be considered as bad practice. Any thoughts? -- Posted via http://www.ruby-forum.com/.
> map.connect '':controller/:action/:id/*anything''> Of course this also means that blog.com/posts/4/anything_else points to >the same place, and I was wondering if this could be considered as bad >practice.You could just have a url version of your blog title in the db. You can then just have your urls like this: /posts/my_blog_title/ rather than including the id. I''ve written a plugin called ''url_column'' that will maintain a url in the table from a specified column automatically on saves and updates. For example, you can do: class Post < ActiveRecord::Base url_column :post_url, :from => :title end Whenever you save or create a post it''ll automatically ''urlify'' the post title and update the post_url column. If you''re interested, i''ll post it up somewhere. Hope that helps! Steve -- Posted via http://www.ruby-forum.com/.
On 6/9/06, Stephen Bartholomew <steve@2404.co.uk> wrote:> > map.connect '':controller/:action/:id/*anything'' > > > Of course this also means that blog.com/posts/4/anything_else points to > >the same place, and I was wondering if this could be considered as bad > >practice. > You could just have a url version of your blog title in the db. You can > then just have your urls like this: > /posts/my_blog_title/ rather than including the id. > > I''ve written a plugin called ''url_column'' that will maintain a url in > the table from a specified column automatically on saves and updates. > > For example, you can do: > > class Post < ActiveRecord::Base > url_column :post_url, :from => :title > end > > Whenever you save or create a post it''ll automatically ''urlify'' the post > title and update the post_url column. > > If you''re interested, i''ll post it up somewhere. > > Hope that helps! >Please post it. That sounds interesting.
Stephen Bartholomew
2006-Jun-19 14:38 UTC
[Rails] [ANN] UrlColumn Plugin (was: Opinions on catch-all routing?)
Hey All, I''ve just packaged up a small plugin i wrote to manage nice urls from a model attribute. It''s available for download here: http://www.2404.co.uk/index.php?path=articles/view.php&articleId=23 I can only apologise in advance for my dodgy blog - don''t let the horrible url and php scare you off :0) This is a very ''new'' plugin so do have a play and let me know the results. Oh and if it''s deemed worthy, i''d like to find a nicer place for it to live - my blog is not really a great advert for a ''nice url'' plugin. Cheers! Steve -- Posted via http://www.ruby-forum.com/.
Wilson Bilkovich
2006-Jun-19 14:42 UTC
[Rails] [ANN] UrlColumn Plugin (was: Opinions on catch-all routing?)
On 6/19/06, Stephen Bartholomew <steve@curve21.com> wrote:> Hey All, > > I''ve just packaged up a small plugin i wrote to manage nice urls from a > model attribute. > > It''s available for download here: > http://www.2404.co.uk/index.php?path=articles/view.php&articleId=23 > > I can only apologise in advance for my dodgy blog - don''t let the > horrible url and php scare you off :0) > > This is a very ''new'' plugin so do have a play and let me know the > results. > > Oh and if it''s deemed worthy, i''d like to find a nicer place for it to > live - my blog is not really a great advert for a ''nice url'' plugin. >Very cool. Thanks for sharing this.
Brent Beardsley
2006-Jun-19 14:59 UTC
[Rails] [ANN] UrlColumn Plugin (was: Opinions on catch-all routing?)
Hi Stephen, Very nice. My only suggestion would be to call it permalink_column instead of url_column. Brent --- Stephen Bartholomew <steve@curve21.com> wrote:> Hey All, > > I''ve just packaged up a small plugin i wrote to > manage nice urls from a > model attribute. > > It''s available for download here: >http://www.2404.co.uk/index.php?path=articles/view.php&articleId=23> > I can only apologise in advance for my dodgy blog - > don''t let the > horrible url and php scare you off :0) > > This is a very ''new'' plugin so do have a play and > let me know the > results. > > Oh and if it''s deemed worthy, i''d like to find a > nicer place for it to > live - my blog is not really a great advert for a > ''nice url'' plugin. > > Cheers! > > Steve > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Xavier Noria
2006-Jun-19 15:10 UTC
[Rails] [ANN] UrlColumn Plugin (was: Opinions on catch-all routing?)
On Jun 19, 2006, at 16:37, Stephen Bartholomew wrote:> Hey All, > > I''ve just packaged up a small plugin i wrote to manage nice urls > from a > model attribute. > > It''s available for download here: > http://www.2404.co.uk/index.php?path=articles/view.php&articleId=23 > > I can only apologise in advance for my dodgy blog - don''t let the > horrible url and php scare you off :0) > > This is a very ''new'' plugin so do have a play and let me know the > results. > > Oh and if it''s deemed worthy, i''d like to find a nicer place for it to > live - my blog is not really a great advert for a ''nice url'' plugin.Nice! Does it handle non-ASCII in UTF-8? -- fxn
Stephen Bartholomew
2006-Jun-19 15:14 UTC
[Rails] Re: [ANN] UrlColumn Plugin (was: Opinions on catch-all routi
> Very nice. My only suggestion would be to call it > permalink_column instead of url_column.Hmm.. good sugguestion - but it''s not really specifically for permenant links. It''ll will be updated if, say, the title of the page changes. In that respect it can be used for categories, pages, products - whatever. Steve -- Posted via http://www.ruby-forum.com/.
Stephen Bartholomew
2006-Jun-19 15:25 UTC
[Rails] Re: [ANN] UrlColumn Plugin (was: Opinions on catch-all routi
> Nice! Does it handle non-ASCII in UTF-8?It uses basic Ruby replaces. I''ve not really tried it with anything more complex than the examples and tests - try it out and let me know :0) Steve -- Posted via http://www.ruby-forum.com/.
Benjamin Curtis
2006-Jun-20 04:52 UTC
[Rails] [ANN] UrlColumn Plugin (was: Opinions on catch-all routing?)
Posted at http://agilewebdevelopment.com/plugins/url_column :) -- Benjamin Curtis http://www.bencurtis.com/ http://www.tesly.com/ -- Collaborative test case management http://www.agilewebdevelopment.com/ -- Resources for the Rails community On Jun 19, 2006, at 7:37 AM, Stephen Bartholomew wrote:> Hey All, > > I''ve just packaged up a small plugin i wrote to manage nice urls > from a > model attribute. > > It''s available for download here: > http://www.2404.co.uk/index.php?path=articles/view.php&articleId=23 > > I can only apologise in advance for my dodgy blog - don''t let the > horrible url and php scare you off :0) > > This is a very ''new'' plugin so do have a play and let me know the > results. > > Oh and if it''s deemed worthy, i''d like to find a nicer place for it to > live - my blog is not really a great advert for a ''nice url'' plugin. > > Cheers! > > Steve > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails