Open Graph Protocol

Nov 20th, 20241 minutes

Open graph protocol (OGP) is a method of treating a web page as an object. This allows platforms like social media to be able to recognise web pages within them. For intance, imagine you have a blog post and you want to post it on Facebook to share with your network. If utilizing the OGP protocol on your blog post page, Facebook can appropriately display it as a regular Facebook post. This makes content more interoperable between platforms. In other words, it allows websites to display content of other websites.

I have implemented the OGP protocol on each of my webpages on this site to allows me to share my blog posts and projects to the different media platforms like Linkedin to have them display my content in an appealing way.

In order to use the graph protocol you simply utilize meta tags on your web pages. Then you can take your page link and share it on any platform that supports the protocol, like Facebook, and it will be able to display that content. If you would like to test out your link you can use the opengraph.dev website to verify that you are using your meta tags correctly.

<meta property="og:title" content="Example Page Title" />
<meta property="og:description" content="This is a brief description of the content of your page. It will appear in the preview when shared on social media." />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://www.example.com/page" />
<meta property="og:image" content="https://www.example.com/image.jpg" />
<meta property="og:image:alt" content="A description of the image for accessibility." />
<meta property="og:site_name" content="Example Site" />
<meta property="og:locale" content="en_US" />
<meta property="og:updated_time" content="2024-11-21T12:00:00Z" />

You can learn more about OGP on their website.