Giter VIP home page Giter VIP logo

sujiakuan / opengraph-meta-describer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aminariana/opengraph-meta-describer

0.0 2.0 0.0 556 KB

Makes a webpage that looks ugly, shared on Facebook with "preview" care and beauty! All by injecting Open Graph META tags.

Home Page: http://opengraph-meta-describer.herokuapp.com

License: MIT License

Ruby 73.72% JavaScript 0.37% CSS 0.19% HTML 25.71%

opengraph-meta-describer's Introduction

opengraph-meta-describer

Makes a webpage that looks ugly, shared on Facebook with "preview" care and beauty! All by injecting Open Graph META tags.

This service is an analog to a URL shortening API that takes a URL to a web page plus a few meta descriptions about that web page, and creates a wrapping webpage for it, augmented with Open-Graph supported meta data. This way, the input URL, which may originally look ugly when shared on Facebook, can look presentable, because Facebook can scrape the auxiliary meta info from the wrapping page. Nothing is actually stored in the service. The response simply reflects the parameters provided in the GET request as Open Graph META tags.

Live production instance

The main production instance for your use:

Documentation

Author:

Documentation site:

The main API is the following path, used in GET requests:

The GET request parameters accepted:

  • title: The title of the page you want to render on Facebook
  • description: The description preview you want to render on Facebook
  • site_name: The name of your web site
  • image: The absolute URL of the image you want rendered on Facebook
  • callback: The landing URL to which the user will be redirected if they click the shared post

The expected response header META tags:

  <title><%= @title %></title>
  <meta name="description" content="<%= @description %>">
  <meta name="keywords" content="keywords">
  <meta property="og:description" content="<%= @description %>">
  <meta property="og:image" content="<%= @image %>">
  <meta property="og:title" content="<%= @title %>">
  <meta property="og:site_name" content="<%= @site_name %>">

The expected response behavior from the user's perspective:

  • User will temporarily land on our production server, and will be immediately redirected to the Callback URL provided.

Benefits

(i.e. why the heck should you wrap your URL this way?)

Share on Facebook and let it pick up Opengraph protocol's expected META tags. Often you're dealing with a page on a server that's not in your control. You should still be able to go ahead and share that page without having Facebook render it in an ugly way. This is how you make it prettier.

Example

You have a boring site such as: http://www.aminariana.com. Try sharing that on Facebook... yeah, see? Do not dispair! You can now make it more interesting when shared on Facebook:

http://opengraph-meta-describer.herokuapp.com/map?callback=http://aminariana.com&title=I%20don't%20always%20meta-meta-describe%20my%20shared%20webpages&description=But%20when%20I%20do,%20it's%20because%20I%20forgot%20to%20meta%20describe%20them%20in%20the%20original%20code&site_name=Amin%20Ariana&image=http://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/Jonathan_Goldsmith_2009.jpg/400px-Jonathan_Goldsmith_2009.jpg

Try sharing that long link on Facebook, then clicking it. Hopefully that'll give you the Aha moment.

License

MIT License. Use with credit and care.

That's all folks. Happy hacking.

opengraph-meta-describer's People

Contributors

aminariana avatar

Watchers

 avatar  avatar

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.