restgoogle-searchgoogle-image-search

How to create an API endpoint to auto generate images and index them to Google?


If you search for "palmeiras x corinthians sofascore", you'll see that SofaScore has:

I have inspected the HTML source code and found this:

<meta property="og:image" content="https://api.sofascore.com/api/v1/images/share/16x9/palmeiras-corinthians-9540700.png"/>

Now, what if I wanna do the same for my website, what should I do:

How do I deal with different aspect ratios?


Solution

  • Here's what I have done:

    Regarding Google indexing it: I just had to place the url for the endpoint in a meta tag with property="og:image".

    The endpoint url can be placed in <img> tags, as well.


    Useful resources: