Skip to content

Instantly share code, notes, and snippets.

@matclayton
Created January 13, 2012 22:11
Show Gist options
  • Save matclayton/1609009 to your computer and use it in GitHub Desktop.
Save matclayton/1609009 to your computer and use it in GitHub Desktop.
Simple Facebook Open Graph App
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# climbingapp: http://ogp.me/ns/fb/climbingapp#">
<!-- Open Graph Meta tags -->
<meta property="og:type" content="climbingapp:mountain" />
<meta property="og:url" content="http://example.com/" />
<meta property="og:title" content="Snowdon" />
<meta property="og:description" content="Snowdon is the highest mountain in Wales" />
<meta property="og:image" content="http://farm8.staticflickr.com/7172/6622506511_3f6a78e781_z.jpg" />
<meta property="og:locale" content="en_GB" />
<meta property="og:site_name" content="Awesome Climbing App" />
<meta property="fb:app_id" content="YOUR_APP_ID" />
<head/>
<body>
<!-- Load Facebook JS SDK -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=YOUR_APP_ID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- Add to Timeline -->
<div class="fb-add-to-timeline" data-show-faces="true" ></div>
<!-- Sample Action -->
<button onclick="FB.api('me/climbingapp:climb', 'post', {'mountain':'http://example.com/'});">
I climbed Snowdon
</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment