Giter Club home page Giter Club logo

fb_metatag's Introduction

Facebook Open Graph Meta tag for Refinery CMS.

Installing

Add refinerycms-fb_metatag to your Gemfile

gem 'refinerycms-fb_metatags', :git => 'git://github.com/sunil-shrestha/fb_metatag.git'

Run generator

rails g refinery:fb_metatag

Run migration

rake db:migrate

Setup fb_metatag

  1. Add new fb_metatag Create new fb-metatag from fb_metatag menu. provide appropriate model or resource name in right format. e.g : refinery/blog/post Default meta tags for resource can be set here. However, meta tag on provided for individual model will be used if provided
  2. Render form for the page to add og metatag fields. e.g. :
    <%= render "/shared/fb_metatag" , :f => f  %>
  1. Add Meta tags at header of your page. i.e. :
<% array=(params[:controller]).split('/') %>
<% model_name = (array.last).singularize.downcase %>
<% @params= instance_variable_get("@#{model_name}") %>
<% if (params[:action]=="show") %>
      <%= raw "<meta property=\"og:title\" content=\"#{@params.og_title}\"/>" %>
      <%= raw "<meta property=\"og:description\" content=\"#{@params.og_description}\"/>" %>
      <%= raw "<meta property=\"og:type\" content=\"#{@params.og_type}\"/>" %>
      <%= raw "<meta property=\"og:url\" content=\"#{request.url }\"/>" %>
      <%= raw "<meta property=\"article:tag\" content=\"#{@params.article_tag}\"/>" %>
      <%= raw "<meta property=\"article:author\" content=\"#{@params.article_author}\"/>" %>
      <%= raw "<meta property=\"og:image\" content=\"http://www.iwa.fi/images/logo.png\"/>" %>
  <% else %>
      <meta property="og:title" content="Iwa Labs Oy" />
      <meta property="og:type" content="company" />
      <meta property="og:url" content="<%= request.url %>" />
      <meta property="og:image" content="http://www.iwa.fi/images/logo.png" />
      <meta property="og:site_name" content="Iwa Labs" />
      <meta property="fb:app_id" content="212311028070" />
      <meta itemprop="name" content="Iwa Labs Oy" />
      <meta itemprop="description" content="" />
      <meta itemprop="image" content="http://www.iwa.fi/images/logo.png" />
  <% end %>
  1. Restart your application: This gem adds og attributes when you add the model to fb_metatag. So it requires restart of application to take it in to affect.

License

Copyright 2013 Iwa Labs Ltd. Licensed under the MIT License.

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.