SEO Friendlier URL With Permalink_Fu
permalink_fu has been great to create a Search Engine Optimized (SEO) friendly URL, but I was a bit irritated when the-permalink-is-getting-too-long-with-too-many-unecessary-keywords.
From some of the SEO tips I read, it is advisable not too put too many keywords in the URL. Unecessary stop words such as ‘the, a, in, on, and the list goes on’ can be removed, and the search engine robots will not be irritated too.
I wrote permalink_fu_hack plugin some time ago to solve this problem, thought some of you may find it useful in your application. To think about all the possible stop words, I took the shortcut, and got the inspiration from SEO Slugs Wordpress plugin by Andrei Mikrukov.
It is a monkey patch for permalink_fu, you need to first install the permalink_fu plugin. It also has an additonal :unique option to turn off the feature to automatically create unique permalink, which on some cases where the permalink already includes a unique primary key id, I find that the extra check is not necessary. With the :unique option, you can set it to false for such occasion.
Installation
script/plugin install git://github.com/technoweenie/permalink_fu.git script/plugin install git://github.com/jugend/permalink_fu_hack.git
Example
class Article < ActiveRecord::Base
has_permalink :title, :filter_stop_words => true,
:unique => false
end
article = Article.new
article.title = 'The Permalink Is Getting Too Long With Too Many Unecessary Keywords'
article.save
puts article.permalink # => 'permalink-getting-long-unecessary-keywords'
Additional has_permalink Options
:unique
# Create unique permalink (default: true).
:filter_stop_words
# Flag to filter to stop words (default: false)
:stop_words
# Array of stop words to filter (default: auto assigned to stop words similar to SEO Slugs Wordpress Plugin).
:max_words
# Maximum number of words to show on permalink (default: 6)

