Shareable with Open Graph and Twitter Cards

Tags: Open Graph, Twitter.

When sharing content across social media platforms, Open Graph and Twitter Card Tags (Twitter's extension of Open Graph) can be used to optimize how information is displayed.

With Open Graph, you can specify aspects of your Facebook or LinkedIn post such as the title, image, and description. On a page without Open Graph tags, the Facebook or LinkedIn crawler will guess which pieces of content to use for each area, although it generally seems to do a good job. More information is available at and

Additionally, when you share a link on Facebook, the crawler will visit the URL to get the metadata. The crawler must see an image before it is displayed. That means the first person to share a piece of content will not see the image. Anoth benefit of using Open Tags is that specifying an image height and width will force Facebook to scrape the image immediately instead of queuing the page to be crawled.

Twitter has a number of Cards available, which are essentially different arrangements of an image and text for different types of content. Twitter extends Open Tags with it's own tags, and can fall back to certain Open Tags. You can get an overview on their developer page:

Since Open Tags need to be used for Facebook and LinkedIn, and Twitter falls back to them, we can avoid duplication by including as many Open Tags as possible and then including the additional Twitter Card tags to meet requirements.

For the site I am working on, we only use tags on Blog posts. These are the only pages where large images and descriptions can be maintained with consistency.

In Drupal, install the MetaTags module with the Open Graph and Twitter Cards sub-modules.

Now edit the tags for this content type. Here are basic fields and tokens to use:

If the authors of your content have their own Twitter accounts, you can configure those to display as well. Through the user's profile, edit the meta tags assigned to them add their @username to the Creator's Twitter account field. You can then specify this token for the appropriate meta tag for the content type.

Here is an example of the tags that will now appear in the head of your page:

<meta property="og:type" content="article" />
<meta property="og:url" content="" />
<meta property="og:title" content="Page Title" />
<meta property="og:description" content="Page Description" />
<meta property="og:image" content="" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="800" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@username" />

Helpful links

Open Tags for the Blog content type

Open Graph tags

Twitter tags for the Blog content type

Remember, set the twitter handle for your site in the global tags.

Twitter tags