I own many github repository and I usually add projects on weekly basis. I am making my own website using github pages, since I can only host static website on Github Pages hence I am Going to Use Github API in Order to Automatically Update My New Projects On My Website. But I also Want to Add a Preview/Sample Image to It.
I Got to Know that there is an Option Named Social Preview Where I can Add an Image of My Repository to be Shown on Social Media.
Although I can Get My all Repo Info From api.github.com
but I can't get my Social Media Preview Image Url.
GitHub GraphQL API v4 has a field to query the OpenGraph image URL. It uses the social image set in the repo settings and fallbacks to the user profile image.
Link to docs and search for "openGraphImageUrl".
You can test this out with GitHub's GraphQL API explorer (sign in required) and query:
{
repository(owner: "vuetifyjs", name: "vuetify") {
openGraphImageUrl
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With