Get a Free Quote

Contact Sales

Edit Template

How to Add Open Graph to Your Website (HTML and WordPress)

Have you ever shared a link on social media and noticed the image or description didn’t show up properly? That happens when your site lacks Open Graph tags. In this tutorial, you’ll learn how to add them to your HTML/CSS website and also to a WordPress site using a simple plugin.

What is Open Graph?

The Open Graph Protocol allows you to control how your website content appears when shared on social media platforms like Facebook, LinkedIn, and WhatsApp. With it, you can define:

  • Title
  • Description
  • Image
  • Link
  • Content Type

Part 1 – How to Add Open Graph to an HTML/CSS Site

Step 1 – Open Your HTML File

Open the main HTML file of your page, usually index.html.

Step 2 – Add the Open Graph Tags Inside <head>

<head>
<meta property="og:title" content="Page Title" />
<meta property="og:description" content="Description that will appear when shared." />
<meta property="og:image" content="https://www.yoursite.com/image.jpg" />
<meta property="og:url" content="https://www.yoursite.com/page" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Site Name" />
</head>

Step 3 – Test It Using Facebook Debugger

  1. Go to https://developers.facebook.com/tools/debug/
  2. Paste your website URL and click “Debug”
  3. Click “Scrape Again” to refresh the data and see the preview

Part 2 – How to Add Open Graph to WordPress Using a Plugin

Step 1 – Install the “Insert Headers and Footers” Plugin

  • Go to your WordPress dashboard
  • Navigate to Plugins > Add New
  • Search for “Insert Headers and Footers”
  • Install and activate the plugin

Step 2 – Add Open Graph Tags in the Header

  1. Go to Settings > Insert Headers and Footers
  2. In the Scripts in Header field, paste the following code:
<meta property="og:title" content="Page Title" />
<meta property="og:description" content="Page description." />
<meta property="og:image" content="https://www.yoursite.com/image.jpg" />
<meta property="og:url" content="<?php echo get_permalink(); ?>" />
<meta property="og:type" content="article" />
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />

💡 If you want to make the content dynamic, use PHP in your theme or a custom plugin.

📌 Final Tips

  • Image Size: Recommended size is 1200x630px.
  • Cache Issues: Use “Scrape Again” in Facebook Debugger to force updates.
  • Twitter Cards: Consider adding Twitter-specific meta tags like twitter:card for Twitter previews.

Leave a Reply

Your email address will not be published. Required fields are marked *

Popular Articles

Everything Just Becomes So Easy

Lorem Ipsum is simply dumy text of the printing typesetting industry lorem ipsum.

Most Recent Posts

Bringing unlocked me an striking ye perceive. Mr by wound hours oh happy. Me in resolution pianoforte continuing we.

Features

Payment Link

Recurring Billing

Invoice Management

Checkout

Integrations

Pricing

Solutions

eCommerce

Finance Automation

Crypto

Global Business

Marketplaces

Resources

Tutorials

Blog

Community

Privacy Policy

About

Company

Careers

FAQ

Contact Us