SEO friendly URLs are more important to make a page popular & search engines to crawl.
FriendlyId is the slugging and permalink plug-in for Ruby on Rails. It allows you to create pretty URLs and work with human-friendly strings.
The URLs created by slug are very useful for SEO. It is designed for generation of URL slug and history maintenance.
Contents
Steps to create Pretty URLs:
Step#1
Include gem in your Gem file:
gem 'friendly_id'
Then run bundle install.
Step#2
Modify your model on which you want the pretty URL:
extend FriendlyId friendly_id :title, use: :slugged
Step#3
Add the slug column in your migration file to add it on the table
add_column :articles, :slug, :string
Then run
rake db:migrate
Now if you create an article with Title like “This is a demo title for testing”,
it will create a SEO friendly URL like “this-is-a-demo-title-for-testing” and will
save into the articles table under slug column.