DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Create Strings For SEO-friendly URLs

09.27.2007
| 9493 views |
  • submit to reddit
        this method returns string, which is perfect for SEO-friendly URLs. 

features: 
- converts every improper character to a hyphen
- returns a lowercase string

I POSTED AN EVEN BETTER METHOD ON MY BLOG: http://labuschin.com/341 

def create_callname (title)
	title.downcase.gsub(/[^a-z0-9]+/i, '-')
end
    

Comments

John Ashton replied on Thu, 2013/12/12 - 1:22pm

 Its interesting but it would have been good if you explain it poroperly, can you repost this article with some more content? I am Sean from Website design Camberley and will be looking for your new post

Ali Jutt replied on Fri, 2012/06/08 - 2:02am

your iformation is really good butt if want to do seo you must first complete knowledge about it and i want to give you a suggestions that is you just read seo tips. seo is broader term it contains two parts on/off page seo google analytics is also a part of off page seo when you just focus on google

Snippets Manager replied on Sun, 2009/10/11 - 6:14am

I recently came across your blog and have been reading along. I thought I would leave my first comment. Alcohol Abuse

Snippets Manager replied on Fri, 2009/10/02 - 9:46am

Does news.yahoo.com really have the directory structure reflected by this URL? Of course not. That would create an astronomical amount of directories in a website with thousands of index.html files.search engine placement