Skip to content
/ 2img Public
forked from vercel/og-image

Open Graph Image as a Service - generate cards for Twitter, Facebook, Slack, etc

License

Notifications You must be signed in to change notification settings

tsathis/2img

 
 

Repository files navigation

Open Graph Image as a Service with Sinhala Support.

aka dynamic image card generator

Serverless service that generates dynamic Open Graph images that you can embed in your <meta> tags.

For each keystroke, headless chromium is used to render an HTML page and take a screenshot of the result which gets cached.

See the image embedded in the tweet for a real use case.

What is an Open Graph Image?

Have you ever posted a hyperlink to Twitter, Facebook, or Slack and seen an image popup? How did your social network know how to "unfurl" the URL and get an image? The answer is in your <head>.

The Open Graph protocol says you can put a <meta> tag in the <head> of a webpage to define this image.

It looks like the following:

<head>
  <title>Title</title>
  <meta property="og:image" content="http://example.com/logo.jpg" />
</head>

Why use this service?

The short answer is that it would take a long time to painstakingly design an image for every single blog post and every single documentation page. And we don't want the exact same image for every blog post because that wouldn't make the article stand out when it was shared to Twitter.

That's where og-image.vercel.app comes in. We can simply pass the title of our blog post to our generator service and it will generate the image for us on the fly!

It looks like the following:

<head>
  <title>Hello World</title>
  <meta property="og:image" content="https://gen-og-image.vercel.app/සීලක්ඛන්ධවග්ගපාළි%20දීඝ%20නිකාය.png?fontFamily=arundathee" />
</head>

Now try changing the text සීලක්ඛන්ධවග්ගපාළි%20දීඝ%20නිකාය.png?fontFamily=arundathee to the title of your choosing and watch the magic happen ✨

example png

Font Families:

?fontFamily=abhaya

Available fonts:

abhaya, alakamanda, arundathee, basuru, bindumathi, davasa, derana, dharanee, disapamok, ganganee, gemunu, gurulugomi, imanee, indeewaree, isiwara,malithi, rajantha, rashmi, samantha, sandhyanee

Forked from Open Graph Image as a Service on vercel/og-image

About

Open Graph Image as a Service - generate cards for Twitter, Facebook, Slack, etc

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 73.5%
  • CSS 15.9%
  • HTML 10.6%