Featured blog image
Web development 6 min read

The Magic Behind Link share : Understanding and Implementing Open Graph

Author

Krishna pariyar

Backend development

We all are sharing links on social media platforms. But have you noticed that whenever you paste a link — whether it’s on Facebook, Twitter, LinkedIn, WhatsApp, or Telegram — it magically generates a rich preview? That preview often includes the title, description, image, URL, and more.

Well, that’s not magic. That’s the Open Graph 

Here at this blog post, we are going to walk you through what Open Graph is, why web developers should care about it , and guide you with the step-by-step how-to on utilizing it on your own website or project. You may be a web developer, content producer, or SEO geek - this is something you definitely need to learn to dramatically increase your link activity and click-through rates.

What is Open Graph

The Open Graph protocal was introduced by Facebook in 2010. It's a way to give web developers more control over their content is display when shared on social media, particularly facebook. this make it more users engaging with content and users can relate with there thoughts

 

Why Use Open Graph?

If you want your content to stand out and spark interest on social media, Open Graph is non-negotiable. Here's why:

  • Enhanced link previews : Instead of showing just a URL, platforms display a card-like preview with image, title, and description.

  • Boosts click-through rates : Attractive previews naturally draw more attention and clicks.

  • Increased engagement : A well-designed preview can encourage users to read, comment, or share your content.

  • Content control : You get to decide how your page appears when shared instead of relying on random guesses from the platform.

  • Professional presentation :  It gives your content a polished, branded look across platforms.

 

Implementing Open Graph in an HTML Page

To enable Open Graph, add meta tags inside the head section of your html page:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta property="og:title" content="Placed Your Page Title Here">
    <meta property="og:description" content="Placed A brief description of your page.">
    <meta property="og:image" content="https://example.com/image.jpg">
    <meta property="og:url" content="https://example.com/your-page">
    <meta property="og:type" content="website">
    <meta property="og:site_name" content="Your Website Name">
    <title>Your Page Title</title>
</head>
<body>
    <h1>Welcome to Open Graph Implementation</h1>
</body>
</html>

 

Explanation of Open Graph Meta Tags

  • og:title : The title of your webpage.
  • og:description : A short description of the page.
  • og:image : URL of the image to display in the preview.
  • og:url : The canonical URL of the page.
  • og:type : Defines the type of content(e.g website, article, video, etc).
  • og:site_name — The name of your site for additional context.

💡 Pro Tip: Use images with a resolution of 1200 x 630 pixels for the best compatibility across platforms.

 

Validating Open Graph Metadata

Once you’ve added Open Graph tags, don’t forget to test how they appear across different platforms. These tools let you do just that:

These tools also highlight errors or missing tags — so you can fix them before your audience sees a broken or boring preview.

 

 

To share a link through <a> tag:

Want to make it super easy for users to share your page? Just use these prebuilt share links. Replace YOUR_URL and YOUR_TEXT accordingly.

1. Facebook Share:

<a href="https://www.facebook.com/sharer/sharer.php?u=YOUR_URL" target="_blank">Share on Facebook</a>

2. LinkedIn Share:

<a href="https://www.linkedin.com/sharing/share-offsite/?url=YOUR_URL" target="_blank">Share on LinkedIn</a>

3. Twitter (X) Share:

<a href="https://twitter.com/intent/tweet?url=YOUR_URL&text=YOUR_TEXT" target="_blank">Share on Twitter</a>

3. WhatsApp Share:

<a href="https://api.whatsapp.com/send?text=YOUR_TEXT%20YOUR_URL" target="_blank">Share on WhatsApp</a>

4. Telegram Share:

<a href="https://t.me/share/url?url=YOUR_URL&text=YOUR_TEXT" target="_blank">Share on Telegram</a>
 

NOTE:

Open Graph doesn't work on local environments like localhost or 127.0.0.1 . Most social media bots can't access your local server because it's not publicy available. but if you are using Public IP it may work.

To test Open Graph tags properly:

  • Deploy your site to a Public URL (even temporarily).
  • You can use free hosting service like:
    • Vercel
    • Netlify
    • Render
  • Or use tunneling tools like Ngrok or Localhost.run to expose your local server.

if you are begginer and want to use simple technique, i'm personally prefer tunneling tools
Once you have a public link, paste it into the Facebook Debugger or other Open Graph validators to see the actual preview.


The internet is noisy - you have just one chance at an incredible first impression. Using Open Graph, you can turn each shared link into a rich experience that reflects your brand and encourages interaction.

It’s a tiny bit of code with a huge impact on how your content is perceived and interacted with. Whether you’re running a portfolio, blog, business site, or e-commerce platform - adding Open Graph is a no-brainer.

So go ahead. Copy those meta tags. Test them. Share your links with confidence.

And if you're still having problems, or just want to say hello, leave a comment below -  I'd be happy to assist.

 

Comments (0)

Share Your Thoughts

Your thoughts inspire us.

250/250