Coder Social home page Coder Social logo

metadescription's Introduction

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!

metadescription's People

Contributors

yanismydj avatar

Stargazers

Milan Rawal avatar Robert Audi avatar Jesse Willis avatar Daniel Pakuschewski avatar Justin Turner avatar Igor Vokatch avatar Brandon McCann avatar Tony Castiglione avatar Bartosz V. Bentkowski avatar Robert Pankowecki avatar Tomé Duarte avatar Nemanja Stojanovic avatar Andrey Krivko avatar  avatar Cyrus Karbassiyoon avatar Anthony Ross avatar  avatar

Watchers

 avatar James Cloos avatar

Forkers

codemilan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.