Add og image tag to images?

Hi,

is there a way to add the og image tag to a image of our choice?
We have a image on here in the header as background which we update every month. We are looking for a way to add a og image tag to this image so that we don’t have to replace the image on more than this one place every month so using plugins like Yoast SEO are not our first choice.

Thanks a lot!

Hello Alex,

Thanks for writing in!

Instead of adding og tag, please go to X/Pro > Theme Options > Social > Open Graph and enable it. You can then insert a fallback image. For your homepage, since there is a need to change the banner image once in a while, we would recommend that you insert the background image as a featured image as well because by default, the OG tag will use the featured image. Once in a while, you can switch the feature image of the page so that the OG:Image tag will be updated as well.

For more details, kindly check this out:

To know how to add a featured image, kindly check this out:

Hope this makes sense.

1 Like

Hi @ruenel, thanks for you answer. While I did know about featured images, I did not know that X/Pro came with their own Fallback Image solution. That’s cool, thanks!

But isn’t it possible to apply the og:image tag to a certain image in cornerstone page builder by adding some kind of code snipped or css ? Changing the image monthly on two places (background in header and e.g. featured image or fallback image or other plugin like Yoast SEO) means one place to much where our staff can forget accidentally, so one source of possible errors we are trying to avoid by this kind of “automatization”.

Hi Alex,

Not currently possible, and may I know why do you need og:image to a certain image in cornerstone? The opengraph data are usually placed within the <head> tag. Not to the body nor to image itself, example,

<meta property="og:image" content="http://example.com/thumbnail.jpg">

And may I know which social media platform requires og:image within the content and directly to the image? Perhaps I just missed something, but facebook doesn’t pull opengraph data from the content nor image elements, it pulls the data from open graph data placed in the head.

And if you’re trying to change SEO data, then I recommend using SEO plugin such as Yoast that you already mentioned, you can control how the data are displayed including images. But make sure to disable X/Pro > Theme Options > Social > Open Graph once you do that to prevent open graph conflicts.

Thanks!

Hi, thanks a lot for your answers!

Maybe I am not understanding open graph correctly, but the thing we want is to make sure og:image pulls the image always from the same location but the path to the image itself is changing every month. We only want to (if possible) change the image in cornerstone and not in cornerstone and e.g. Yoast.

Hi Alex,

The social media platform store the data permanently, it will be the same even if you change it every month until you clear it using their tool, example https://developers.facebook.com/tools/debug/, and https://www.braveriver.com/blog/how-to-clear-facebook-open-graph-and-twitter-cards-cache-on-demand/.

Hence, even if you can automate the opengraph changes every month, you’ll still need to clear them manually for each social platform. And with that, if you’re going on that direction then it’s still best to set image through SEO Yoast manually for every month.

But either way, you have no other options but using SEO Yoast and or change featured image manually to make sure og:image is changed as well, regardless of the image path.

Thanks!

1 Like

Thanks for making us understand open graph better! We will use Yoast SEO then.

You’re most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.