Skip to content

Latest commit

 

History

History
40 lines (23 loc) · 942 Bytes

README.rdoc

File metadata and controls

40 lines (23 loc) · 942 Bytes

Metamagic is a simple Ruby on Rails plugin for creating meta tags.

Installation

In your Gemfile:

gem 'metamagic'

Then run bundle install.

Example

In your controller:

def show
  @product = Product.find(params[:id])

  meta :title => @product.name, :description => @product.description, :keywords => @product.tag_list
end

In your application.html.erb:

<head>
  <title>My Site</title>
  ...
  <%= metamagic :title => "My default title", :description => "My default description.", :keywords => %w(keyword1 keyword2 keyword3) %>
  ...
</head

For custom meta tags, just call it like this in your controller:

meta :title => "My title", :my_custom_tag => "My custom value"

To use in conjunction with the headliner plugin (github.com/mokolabs/headliner):

<%= metamagic :title => @title %>

Copyright © 2010 Lasse Bunk, released under the MIT license