Omid Sayfun
Omid SayfunComputer Geek
Home
Notebook
Journey

Online

Github
Linkedin
Hevy
Plyatomic
Notebook
The trap of making everything dynamic
March 01, 2024
A try at type-safe groupBy function in TypeScript
April 10, 2025
Email special headers
November 20, 2024
Adding prettier to eslint
April 10, 2025
Storing Vector in Postgres with Drizzle ORM
March 21, 2024
Upgrading my blog to Next 15
April 05, 2025
Canvas macOS issue
February 20, 2024
tsx doesn’t support decorators
March 26, 2025
Validating NestJS env vars with zod
February 06, 2025
Extending Window: types vs interfaces
March 21, 2025
Loading env file into Node process
February 06, 2025
Add update date field to Postgres
February 27, 2024
Using node API for delay
February 06, 2025
React Component Lifecycle
November 28, 2024
How CQRS is different than Event Sourcing
August 18, 2024
RabbitMQ exchange vs queue
August 14, 2024
PgVector similarity search distance functions
August 13, 2024
PgVector indexing options for vector similarity search
July 31, 2024
Using puppeteer executable for GSTS
June 08, 2024
Why EQ is Your Next Career Upgrade
May 13, 2024
Counting GPT tokens
June 30, 2024
Logging route handler responses in Next.js 14
June 19, 2024
Redirect www subdomain with Cloudflare
June 17, 2024
Logging requests in Express app
June 16, 2024
Move Docker volume to bind mount
June 12, 2024
Next.js Hydration Window Issue
May 29, 2024
Using Git rebase without creating chaos in your repo
May 16, 2024
Implementing RPC Calls with RabbitMQ in TypeScript
March 16, 2024
Optimize webpage load with special tags
March 15, 2024
What the hell is Open Graph?
March 13, 2024
My go-to Next.js ESlint config
March 10, 2024
List of useful Chrome args
March 10, 2024
Combining RxJS observables - Part 1
February 20, 2024

What the hell is Open Graph?

March 13, 2024

Imagine you've created an amazing blog post or created a visually stunning product page. But when you share the link on social media, it appears with a generic title, a non-sense description, and no image. Not exactly the best thing!

This is where Open Graph (OG) tags come in. These tags act like a social media translator for web pages. They tell different platforms like Facebook, Twitter, and LinkedIn how to display your content when it's shared.

Benefits

  • Visual storytelling: OG tags allow you to choose the image that appears alongside your link. This is crucial for grabbing attention in a social media feed overflowing with text.
  • Headlines: First impressions are everything, and OG tags allow you to curate the perfect preview for your content.
  • Brand consistency: Ensure your brand's message stays uniform across platforms.
  • SEO advantage: While not a direct ranking factor, compelling social media previews can lead to more clicks and engagement, which can indirectly improve your search engine optimization.

Still not convinced?

  • Increased CTR (Click-Through Rates): Eye-catching visuals and good headlines can significantly increase the number of people who visit your website from social media.
  • Improved brand awareness: Stand out from the crowd with a professional and visually appealing presence.
  • Driving traffic: Get more eyes on your content, potentially leading to more leads or sales.

Getting started

Adding OG tags is a relatively simple process. There are numerous online tools and plugins available to streamline the implementation on your website. However, it's important to remember that these tags reside in the code of your webpage. You can always check Open Graph website for the full list of supported tags but here is a list of tags that I usually use:

Main tags

  • og:title : Defines the title that appears in the social media preview (ideally under 60 characters).
  • og:type : Specifies the type of content being shared. Common types are:
    • article (for blog posts, news articles)
    • website (for general websites)
    • book (for books)
    • product (for products)

Continue Reading

  • video (for videos)
  • More types are available. Check OG documentations!
  • og:image : Provides the URL of a high-quality image (ideally at least 1200x630 pixels) that will be displayed in the social media preview.
  • og:description : A concise (ideally under 200 characters) summary of your content that appears in the social media preview.
  • Additional Optional OG Tags:
    • og:url: The canonical URL of the web page being shared. (default: current page URL)
    • og:site_name: The name of your website.
    • og:locale: The language of the content.
    • og:audio: URL to an audio file (if you have one).
    • og:video: URL to a video file (if you have one).
  • Example

    This post is just an introduction to OpenGraph but if it was a comprehensive guide, tags would look like this:

    <head>
    	<title>A Comprehensive Guide to Open Graph (OG) Tags</title>
    	<meta
    		name="description"
    		content="Master OG tags to enhance your social media sharing and engagement."
    	/>
     
    	<meta
    		property="og:title"
    		content="A Comprehensive Guide to Open Graph (OG) Tags"
    	/>
    	<meta property="og:type" content="article" />
    	<meta property="og:image" content="https://example.com/banner.jpg" />
    	<meta
    		property="og:description"
    		content="Learn everything you need to know about OG tags, from their importance to implementation. Boost your social media sharing and engagement!"
    	/>
    	<meta property="og:url" content="https://www.example.com/your-article-page" />
    </head>
    • 02-20-2026

      The trap of making everything dynamic

    • 04-11-2025

      A try at type-safe groupBy function in TypeScript

    • 04-10-2025

      Email special headers

    • 04-10-2025

      Adding prettier to eslint

    • 04-09-2025

      Storing Vector in Postgres with Drizzle ORM