public
Description: Get your xHTML meta tags in control.
Homepage:
Clone URL: git://github.com/linkingpaths/meta_tags.git
Click here to lend your support to: meta_tags and make a donation at www.pledgie.com !
name age message
file MIT-LICENSE Thu Dec 11 09:29:01 -0800 2008 first commit [aitor]
file README.md Mon Dec 15 11:46:06 -0800 2008 more fixes [aitor]
file Rakefile Thu Dec 11 09:29:01 -0800 2008 first commit [aitor]
file init.rb Mon Dec 15 12:03:10 -0800 2008 added init.rb for compatibility issues and ci'd... [aitor]
directory lib/ Mon Dec 22 10:58:11 -0800 2008 use of write_inheritable_attribute in the class [aitor]
file meta_tags.gemspec Mon Dec 15 12:03:10 -0800 2008 added init.rb for compatibility issues and ci'd... [aitor]
directory rails/ Mon Dec 15 11:54:22 -0800 2008 gemspec fixed and trashed a few useless files [aitor]
directory test/ Mon Dec 22 10:58:11 -0800 2008 use of write_inheritable_attribute in the class [aitor]
README.md

meta_tags

A rails plugin that gives you control over the xhtml meta tags rendered in your template on a application/controller/action basis.

Install

´sudo gem install linkingpaths-meta_tags´

The junk

  • In your controllers

You can setup a default value for any meta name/content pair in your application controller:

class ApplicationController < ActionController::Base
  meta  :title        => "My default page title",
        :description  => "Add a sexy default description here.",
        :keywords     => "sex, lies, video tapes"
end

Additionally you can get these values overwrited in any controller/action:

class SpecificController < ApplicationController
  meta :title => "This is an app related controller"

  def spice_up
    meta :title => "overwriten in this action",
         :keywords => "p0rn, Jenna Jameson, Kristal Summers"
    render
    # :title => "toverwriten in this action"
    # :keywords => "p0rn, Jenna Jameson, Kristal Summers"
    # :description => "My default page description"
  end

  def not_spice_up
    render
    # :title       => "This is an app related controller"
    # :description => "Add a sexy default description here."
    # :keywords    => "sex, lies, video tapes"
  end

end
  • In your views

Some helpers are automatically available in your views:


<%= title_tag %>
# Should render as This is an app related controller

<%= meta_tag :title %>
# Should render as 

<%= meta\_tags %>
# Should render all the meta tags defined
# 
# 
# 

Credits

This one is highly inspired by merb_meta. If you don't like the api you can try rails-meta_tags, kpumuk's meta-tags or meta_on_rails.

More

meta_tags on github

Copyright (c) 2008 Linking Paths, released under the MIT license