Blog/Using Open Graph Images over github-readme-stats
profile picture
Yash Singh
Using Open Graph Images over github-readme-stats

Using Open Graph Images as an Alternative to github-readme-stats

In this article, I will show you how to use GitHub's Open Graph Images to create a card for your repository. It is a pretty cool and lightweight feature when you don't want to use something more advanced like github-readme-stats (or if github-readme-stats banned you).

What is Open Graph Images?

Have you ever pasted a link into a message bar and gotten a pretty neat preview of the page with an image, title, description, and text?

That is through a specification called Open Graph that specifies the format for og:* metadata that can be detected by social networks or chatting platforms like Discord and Google Chat.

What is the format for GitHub?

Here is the format:

https://opengraph.githubassets.com/1/<owner>/<repo>

Here is it in HTML:

<img src="https://opengraph.githubassets.com/1/<owner>/<repo>" />