Meta on Rails plugin for meta tags

Meta on Rails is a very simple rails plugin to help you customize your pages’ meta tags a little bit easier.

How to Install

Meta on Rails is hosted on github. For Rails 2.1 or later, install in this way:

./script/plugin install git://

For Rails 2.0.2 or older, need to clone the public git url:

git clone git:// vendor/plugins/meta_on_rails


Add the following code to the layout (e.g. app/views/layout/application.html.erb), and be sure to put it in the head tag:

<%= display_meta(:keywords => "default,keywords", :description => "default description") %>

Values passed to the display_meta method becomes the site-wide default values. In the above example, these two meta tags will be generated on all pages if they’re not overridden on the views:

<meta name="description" content="default description" />
<meta name="keywords" content="default,keywords" />

Then add this code to the view to set meta tags on that page:

<% set_meta(:keywords => 'my,keyword', :generator => 'a bad <script /> generator') %>

The output html will be like this (note that html tags are tripped):

<meta name="generator" content="a bad  generator" />
<meta name="description" content="default description" />
<meta name="keywords" content="my,keyword" />

Dead simple, right?


Feel free to leave a message if you have any suggestion or find bugs.