Prepare your site for social sharing via Facebook

Since Facebook launched their share link feature anyone including you can share your site or pages to their friends. You can tailor what is displayed on the Facebook wall in terms of title, description image and URL.

Facebook is smart enough to use the html meta tags on your page for title and description and it may list some or all of the tags to the user to choose from. This is great as a starting point and may be enough in many cases, however in some it is not.

Use open graph to tailor shared web pages

Say that you put a Like button on a page. What happens when a user Likes it is that Facebook uses the title and description as before but it may try to pick an image from the page, probably closest in proximity to the Like button. This may not be what you want as you might want a specific image to be displayed on Likes.

Open Graph protocol

The Open Graph protocol enables you to integrate your web pages into the Facebook social graph. You can turn your pages into graph objects by adding additional meta information.

<html xmlns:og="http://ogp.me/ns#">
  <head>
    <title>Join the dark side with Son of Obsidian Visual Studio color schemetitle>
    <meta property="og:title" content="Join the dark side with Son of Obsidian Visual Studio color scheme"/>
    <meta property="og:type" content="article"/>
    <meta property="og:url" content="http://rickardnilsson.net/post/2011/05/05/join-the-dark-side-with-son-of-obsidian.aspx"/>
    <meta property="og:image" content="http://rickardnilsson.net/image/Rickard_Nilsson.jpg"/>
    <meta property="og:description"
          content="Join the dark side with Visual Stuide color scheme
          Son of Obsidian. Download it from http://studiostyl.es/"/>
    ...
  head>
  ...
html>

Additional images

One image may not be enough e.g. when users share your page with the above mentioned Share link feature. To still enable users to pick one of the images on your page you can add additional og:image tags to the header.

Loading
Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.