SEO friendly title tag plugin

I’ve come across a small, but very useful plugin for Ruby on Rails applications.
It was designed with SEO in mind, and it makes keeping your meta title tags, and your <h1> tags in sync easy.

The plugin is hosted at (the very awesome) GitHub : http://github.com/DefV/title_helper/tree/master

Here’s how it works.

In your application layout you call the plugin, passing in your overall site title.


<title><%= title :site_name => "The SEO on Rails Blog" %></title>

If you do nothing else, all pages on your site will have the title “Seo on Rails”.

In your view templates, say app/views/blogpost/view.html.erb you could have this:


<%= title "SEO plugins for Ruby on Rails" %>

This will print out a H1 tag:

SEO plugins for Ruby on Rails



At the same time, the plugin will remember the title and insert it into the layout’s <title> tag before your :site_name.
In our example that would result in :

SEO plugins for Ruby on Rails – The SEO on Rails Blog

Keeping your <H1> tags and your <title> tags in sync is a good thing, and this plugin helps make it very easy.