Set Open Graph settings via custom code

I have a web page that takes parameters via the URL to create custom page content. This URL will likely be shared on social media and I’d like the custom page content to be reflected in the post.

How do I go about setting the Open Graph settings in the custom code?

Do you have something to show us?

Yep here you go

The text parameter is “test” and the image parameter is… well you see it lol.

I’d like for my Open Graph title to be the text parameter and the Open Graph image url to be my image parameter but I can only edit them in the page settings it seems.

Hmm, doesn’t seem to be possible with JavaScript, as the tags have to be written on the server side.

Update Facebook Open Graph meta tag through JavaScript - Stack Overflow

However, you might be able to use different share links for each social media like these:

javascript - How to change open graph meta tags to share custom content on social media? - Stack Overflow

Ah ok thanks. Think I might have to learn php for this one :sweat_smile: