facebook-open-graph-twitter-card-large

How to customize Facebook Open Graph and Twitter Card meta tags

Daisy Suman's Layout avatar

Picture this: You are ready with the perfect blog post and an eye-catching featured image to go with it. But the moment you share it on Facebook or Twitter, the image gets cropped at the wrong places. Worse still, there is either no image or the image is so small that it is easy to scroll right past, thus missing the post altogether. At some point in our blogging journeys, we’ve all been there.

A poorly sized image not only dilutes the message you are trying to pass to your followers, it also reduces the posts’ shareability. Even your most ardent fans will hesitate to share your content (no matter how informative it may be) if it is not accompanied by a relevant featured image, optimized for the platform in question.

A picture is worth a thousand words, no doubt, but if you don’t actively seek to take control of your social media images, those may turn out to be the wrong words. So, how can you avoid this pitfall and optimize your blog images for social sharing?

Open Graph and Twitter Card meta tags are the solutions for this.

What are Open Graph and Twitter Card Meta Tags?

Introduced by Facebook in 2010, the Open Graph tags are a set of meta tags used to facilitate any web page to become a rich object in a social graph by allowing you, the content publisher, to control the elements that are displayed when you share your page on Facebook. Since its introduction, the Open Graph protocol has been adopted by LinkedIn and Pinterest, too. Twitter uses a protocol employing Twitter Cards, which is similar in function to Facebook’s Open Graph.

If you visit a site where Open Graph and Twitter Cards are enabled and do a view source of the content, the meta tags might look like the example below (with the “content” information replaced appropriately):

facebook-open-graph-twitter-card-source

When included, the Open Graph and Twitter Card tags do not directly impact the page’s SEO, but they impact how the page displays on social platforms and more importantly, gives the publisher a level of control over the elements to display when their pages get shared on social media by anyone.

How to implement Open Graph and Twitter Card tags on your WordPress site

So far so good. But the question that arises next is how to manipulate the Open Graph and Twitter Card meta tags to get the best display results for your post on social media. The good news is there are several plugins to choose from to implement these meta tags. In this article, I’ll primarily focus on the Yoast SEO plugin’s premium meta tag features, but then I’ll talk about a few other ways you can go about it.

Yoast SEO for WordPress

If you don’t already have the premium version Yoast SEO installed on your WordPress site, that’s the first step to optimizing your blog images for social. This plugin makes adding Facebook Open Graph and Twitter Card meta tags very easy. Here’s a step-by-step guide on how to enable the social meta tags using the Yoast SEO plugin.

1. Set up Yoast SEO

Navigate to the Yoast SEO plugin’s “Social” tab from your WordPress site’s dashboard. Fill out the details associated with your site’s social media platforms on the “Accounts” tab.

yost-seo-social-account-settings

Enable Open Graph meta data on the “Facebook” tab and fill in the other relevant details as required on the page.

yoast-seo-facebook-settings

Enable Twitter card meta data on the “Twitter” tab and fill in the relevant information as required on the page.

Note: It is better to use “Summary with large image” for Twitter because tweets with large images get more engagement than the ones with small or no images. Then your tweets will look like this:

twitter-summary-image-example

Once you have completed these steps, Facebook Open Graph and Twitter Card meta tags will be enabled on all your posts. (This is a one-time setup!)

However, the images that will be picked for social sharing by these tags will still not be uniquely customized for the platforms in question. For that to happen, you will need to do an additional step on the individual posts you wish you share. (This is a step that you will need to repeat for each new blog post).

2. Select specific images to share on Facebook and Twitter

When you scroll down to the Yoast SEO section of a newly created post (or any post in edit mode), the second tab in the Yoast SEO section lets you select the social sharing details. You can use this tab to edit both Facebook’s and Twitter’s image, title, description, etc.

yoast-seo-blog-edit-settings

And that’s it! Just a couple things to keep in mind:

  1. Yoast suggests a featured image size of 1200px by 630px for Facebook and 1024px by 512px for Twitter. Through trial and error, I’ve found that any horizontal image with the width to height ratio of 2:1 and a width greater than 450px works fine for both Facebook and Twitter. For more information on social media sizes, check out this guide from Sprout Social and these guidelines from Buffer.
  2. If you are changing the featured images for Facebook retroactively after you have already shared your post link at least once before, you must run your URL through the Facebook Sharing Debugger, so that the old cached information can be refreshed and it can pick up the new featured image from then on.

Other WordPress plugins for optimizing social media images

If you are not using the Yoast SEO plugin, then there are other WordPress plugins that can help you get the job done. Here are a few other plugin options you can choose from depending on your preference and site compatibility:

How to use PHP to manually add Open Graph and Twitter Card meta data to your WordPress theme

Finally, if you are looking for a tech-savvy solution instead of a plugin, you can always opt to directly add the meta tags to your WordPress theme by manually including the necessary PHP code into your theme’s function.php file. Here are a few links on how you can do that with step-by-step instructions:

Please note: You may need to customize the reference code provided above to suit your particular website’s theme design.

Once you understand the meta tags stringing your social media posts together, you can have them up and running on your WordPress site in no time. And the ROI? Well, your posts will perform way better on social media and you will have much better control over how they appear and what they convey, making them both meaningful and shareable.

Comments ( 13 )

  1. msn hotmail login

    June 15, 2017

    Facebook is popular in all countries

  2. usps tracking

    October 3, 2017

    I read some articles on this site and I think your blog is really interesting and has great information. Thank you for your sharing.

  3. color switch

    January 31, 2018

    That's a good style, friend! Try yourself as a creative writer.You can definitely earn something!

  4. china visa, america visa, student visa, singapore visa

    March 7, 2018

    I hope you may maintain in submitting new content articles & thank you for sharing your great experience among us.

  5. Sasi Kumar

    March 14, 2018

    great tutorial. thanks for brief guide

  6. animal jam

    April 8, 2018

    Your article is easy to understand, the simple way of communicating is accessible to the majority of people. I will keep track of your posts regularly.

  7. decanters

    April 17, 2018

    Hello, I’m truly enjoying the design and layout of your site. It’s very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Superb work!

  8. Max

    April 17, 2018

    How would I remove the "By ..." from appearing on the card?
    Currently we have an issue where it displays as:

    We just want the first website name to appear and not twice.

    site-name | By site-name

  9. charitable trusts

    June 19, 2018

    You have a decent point here!I thoroughly concur with what you have said!!Thanks for sharing your views...hope more individuals will read this article!!!

  10. ibankhours

    June 23, 2018

    Thanks for sharing your idea. I appreciate your work.

  11. regions bank hours

    June 25, 2018

    Thanks for sharing your idea. Your article is easy to understand, the simple way of communicating is accessible to the majority of people. I will keep track of your posts regularly.

  12. espiritsoftwares

    July 13, 2018

    Thanks for sharing facebook graph and twitter meta tags

  13. gmail login

    July 16, 2018

    Thanks for sharing your idea. Your article is easy to understand, the simple way of communicating is accessible to the majority of people. I will keep track of your posts regularly.

Join the discussion