0.01
No commit activity in last 3 years
No release in over 3 years
It is a very simple Rails plugin to help you customize your pages' meta tags a little bit easier.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.5.2
>= 0
> 2.0

Runtime

 Project Readme

MetaOnRails

MetaOnRails DRYs up your page meta tags. It is a very simple Rails plugin to help you customize your pages' meta tags a little bit easier.

Install

Add this to your Gemfile:

gem "meta_on_rails"

Example

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

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

Default meta values can be set. In the above example, these two meta tags will be generated 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:

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

Facebook support

<% set_meta(:title=>"my title", :facebook=>{:title=>"album title test", :type=>"og_mysite_dev:album"}) %>

The output html will be like this:

<meta name="title" content="my title"/>
<meta property="og:title" content="album title test"/>
<meta property="og:type" content="og_mysite_dev:album"/>

Author

Copyright (c) 2008 - 2011 James Chen (@ashchan), released under the MIT license