Introduction
+Introduction
+The Open Graph protocol enables any web page to become a rich object in a social graph. For instance, this is used on Facebook to allow any web page to have the same functionality as any other object on Facebook.
+While many different technologies and schemas exist and could be combined together, there isn't a single technology which provides enough information to richly represent any web page within the social graph. The Open Graph protocol builds on these existing technologies and gives developers one thing to implement. Developer simplicity is a key goal of the Open Graph protocol which -has informed many of the technical design decisions. -
+has informed many of +the technical design decisions. +-
Basic Metadata
+ +Basic Metadata
+To turn your web pages into graph objects, you need to add basic metadata to
your page. We've based the initial version of the protocol on
RDFa which means that you'll place
additional <meta> tags in the <head> of your web page. The four required
properties for every page are:
og:title- The title of your object as it should appear within the graph, e.g., "The Rock".
@@ -54,8 +60,10 @@
og:url - The canonical URL of your object that will be used as its
permanent ID in the graph, e.g., "https://www.imdb.com/title/tt0117500/".
As an example, the following is the Open Graph protocol markup for The Rock on IMDB:
+<html prefix="og: https://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
@@ -68,15 +76,18 @@
-Optional Metadata
+ +Optional Metadata
+The following properties are optional for any object and are generally recommended:
+og:audio- A URL to an audio file to accompany this object.og:description- A one to two sentence description of your object.og:determiner- The word that appears before this object's title in a sentence. An enum of (a, an, the, "", auto). Ifautois -chosen, the consumer of your data should chose between "a" or "an". +chosen, the consumer of your data should choose between "a" or "an". Default is "" (blank).og:locale- The locale these tags are marked up in. Of the formatlanguage_TERRITORY. Default isen_US.
@@ -86,7 +97,9 @@ og:video- A URL to a video file that complements this object.
For example (line-break solely for display purposes):
+<meta property="og:audio" content="https://example.com/bond/theme.mp3" />
<meta property="og:description"
content="Sean Connery found fame and fortune as the
@@ -98,14 +111,20 @@
+
The RDF schema (in Turtle) can be found at ogp.me/ns.
+-
Structured Properties
+ +Structured Properties
+Some properties can have extra metadata attached to them.
These are specified in the same way as other metadata with property and
content, but the property will have extra :.
The og:image property has some optional structured properties:
og:image:url- Identical toog:image.og:image:secure_url- An alternate url to use if the webpage requires @@ -115,39 +134,52 @@og:image:height- The number of pixels high.og:image:alt- A description of what is in the image (not a caption). If the page specifies an og:image it should specifyog:image:alt.
A full image example:
-<meta property="og:image" content="https://example.com/ogp.jpg" />
+
+<meta property="og:image" content="http://example.com/ogp.jpg" />
<meta property="og:image:secure_url" content="https://secure.example.com/ogp.jpg" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="400" />
<meta property="og:image:height" content="300" />
<meta property="og:image:alt" content="A shiny red apple with a bite taken out" />
+
The og:video tag has the identical tags as og:image. Here is an example:
-<meta property="og:video" content="https://example.com/movie.swf" />
+
+<meta property="og:video" content="http://example.com/movie.swf" />
<meta property="og:video:secure_url" content="https://secure.example.com/movie.swf" />
<meta property="og:video:type" content="application/x-shockwave-flash" />
<meta property="og:video:width" content="400" />
<meta property="og:video:height" content="300" />
+
The og:audio tag only has the first 3 properties available
(since size doesn't make sense for sound):
-<meta property="og:audio" content="https://example.com/sound.mp3" />
+
+<meta property="og:audio" content="http://example.com/sound.mp3" />
<meta property="og:audio:secure_url" content="https://secure.example.com/sound.mp3" />
<meta property="og:audio:type" content="audio/mpeg" />
+
-Arrays
+
+Arrays
+
If a tag can have multiple values, just put multiple versions of the same
<meta> tag on your page. The first tag (from top to bottom) is given
preference during conflicts.
+
<meta property="og:image" content="https://example.com/rock.jpg" />
<meta property="og:image" content="https://example.com/rock2.jpg" />
+
Put structured properties after you declare their root tag. Whenever
another root element is parsed, that structured property
is considered to be done and another one is started.
+
For example:
+
<meta property="og:image" content="https://example.com/rock.jpg" />
<meta property="og:image:width" content="300" />
<meta property="og:image:height" content="300" />
@@ -155,31 +187,44 @@ Arrays
<meta property="og:image" content="https://example.com/rock3.jpg" />
<meta property="og:image:height" content="1000" />
+
means there are 3 images on this page, the first image is 300x300, the middle
one has unspecified dimensions, and the last one is 1000px tall.
+
-Object Types
+
+Object Types
+
In order for your object to be represented within the graph, you need to
specify its type. This is done using the og:type property:
+
<meta property="og:type" content="website" />
+
When the community agrees on the schema for a type, it is added to the list
of global types. All other objects in the type system are
CURIEs of the form
+
<head prefix="my_namespace: https://example.com/ns#">
<meta property="og:type" content="my_namespace:my_type" />
+
The global types are grouped into verticals. Each vertical has its
own namespace. The og:type values for a namespace are always prefixed with
the namespace and then a period.
This is to reduce confusion with user-defined namespaced types which always
have colons in them.
-Music
+
+Music
+
- Namespace URI:
https://ogp.me/ns/music#
+
og:type values:
+
+
music:duration - integer >=1 - The song's length in seconds.
music:album - music.album array -
@@ -191,7 +236,9 @@ music:musician - profile array -
The musician that made this song.
+
+
music:song - music.song - The song on this album.
music:song:disc - integer >=1 -
@@ -203,23 +250,32 @@ music:release_date - datetime -
The date the album was released.
+
+
music:song - Identical to the ones on music.album
music:song:disc
music:song:track
music:creator - profile - The creator of this playlist.
+
+
music:creator - profile - The creator of this station.
-Video
+
+Video
+
- Namespace URI:
https://ogp.me/ns/video#
+
og:type values:
+
+
video:actor - profile array -
Actors in the movie.
@@ -235,7 +291,9 @@ video:tag - string array -
Tag words associated with this movie.
+
+
video:actor - Identical to video.movie
video:actor:role
@@ -247,17 +305,26 @@ video:series - video.tv_show -
Which series this episode belongs to.
+
+
A multi-episode TV show.
The metadata is identical to video.movie.
+
+
A video that doesn't belong in any other category.
The metadata is identical to video.movie.
-No Vertical
+
+No Vertical
+
These are globally defined objects that just don't fit into a vertical but
yet are broadly used and agreed upon.
+
og:type values:
+
article - Namespace URI: https://ogp.me/ns/article#
+
article:published_time - datetime -
When the article was first published.
@@ -271,7 +338,9 @@ string array -
Tag words associated with this article.
+
book - Namespace URI: https://ogp.me/ns/book#
+
book:author - profile array - Who wrote this book.
book:isbn - string -
@@ -280,19 +349,27 @@ string array -
Tag words associated with this book.
+
profile - Namespace URI: https://ogp.me/ns/profile#
+
profile:first_name - string - A name normally given to an individual by a parent or self-chosen.
profile:last_name - string - A name inherited from a family or marriage and by which the individual is commonly known.
profile:username - string - A short unique string to identify them.
profile:gender - enum(male, female) - Their gender.
+
website - Namespace URI: https://ogp.me/ns/website#
+
No additional properties other than the basic ones.
Any non-marked up webpage should be treated as og:type website.
+
-Types
+
+Types
+
The following types are used when defining attributes in Open Graph protocol.
+
Type
@@ -351,42 +428,36 @@
URL
A sequence of Unicode characters that identify an Internet resource.
- All valid URLs that utilize the https:// or https:// protocols
+ All valid URLs that utilize the http:// or https:// protocols
+
-Implementations
+
+Implementations
+
The open source community has developed a number of parsers and publishing
tools. Let the Facebook group know if you've built something awesome too!
+
-- Facebook Object Debugger -
-Facebook's official parser and debugger
+- Facebook Object Debugger - Facebook's official parser and debugger.
- Google Rich Snippets Testing Tool - Open Graph protocol support in specific verticals and Search Engines.
-- PHP Validator and Markup Generator - OGP 2011 input validator and markup generator in PHP5 objects
-- PHP Consumer -
-a small library for accessing of Open Graph Protocol data in PHP
-- OpenGraphNode in PHP -
-a simple parser for PHP
-- PyOpenGraph -
-a library written in Python for parsing Open Graph protocol
-information from web sites
-- OpenGraph Ruby -
-Ruby Gem which parses web pages and extracts Open Graph protocol markup
-- OpenGraph for Java -
-small Java class used to represent the Open Graph protocol
-- RDF::RDFa::Parser -
-Perl RDFa parser which understands the Open Graph protocol
-- WordPress plugin -
-Facebook's official WordPress plugin, which adds Open Graph metadata to WordPress powered sites.
-- Alternate WordPress OGP plugin -
-A simple lightweight WordPress plugin which adds Open Graph metadata to WordPress powered sites.
+- PHP Validator and Markup Generator - OGP 2011 input validator and markup generator in PHP5 objects.
+- PHP Consumer - A small library for accessing of Open Graph Protocol data in PHP.
+- OpenGraphNode in PHP - A simple parser for PHP.
+- PyOpenGraph - A library written in Python for parsing Open Graph protocol information from web sites.
+- OpenGraph Ruby - Ruby Gem which parses web pages and extracts Open Graph protocol markup.
+- OpenGraph for Java - Small Java class used to represent the Open Graph protocol.
+- RDF::RDFa::Parser - Perl RDFa parser which understands the Open Graph protocol.
+
+
+