Awesome Open Source
Awesome Open Source

MetaDescription

Gem Version

Metadescription allows you to easily specify lots of different metadescriptions for all your different pages/controller actions. This is helpful for SEO

Installation instructions

  • Add to your Gemfile
gem 'meta_description', github: 'yanismydj/metadescription'
  • Add the tag to your application.html.erb file in your <head> section
<%= metadescription %>
  • Create and customize a meta_descriptions.yml file in config/meta_descriptions.yml Example file:
default: 'this is the default meta description'
home:
  index: 'this is the meta description for the home#index page'
your_controller_here:
  your_action_name_here: 'the metadescription for your_controller_here#your_action_name_here'
other_controller:
  all: 'this metadescription will be used controllerwide for this controller'

Overriding metadescription for an action or a controller

If you need to set the metadescription for a specific action or controller, just set a @metadescription instance variable in your action or in your controller IE:

# action specific
class HomeController < ApplicationController
  def index
    @metadescription = "This page is SEO optimized for whatever it does!"
  end
end
# controller specific
class HomeController < ApplicationController
  before_filter :set_metadescription

  def index
  end

  private
  def set_metadescription
    @metadescription = "This page is SEO optimized for whatever it does!"
  end
end

That's it!

Alternatives To Metadescription
Select To Compare


Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Ruby (225,272
Ruby On Rails (68,337
Actions (55,330
Seo (3,404