How can I set og:image from within my addon?


Active member

I use a custom media page processing images in a custom addon. Now I would like to use one of these images as my pages og:image.

What I did first was to add
<meta property="og:image" content="../myimage.jpg" /> to my pages content. However, this is not the correct position for og:image. The Facebook debugger showed an error message saying that og:image has to be part of the <head>.

Now I'm searching for a simple possibility to move this og:image-string up to the head. Is there a kind of a "set_meta_tag" function in xenforo? I know these kind of functions from other cms systems. Would be great.

Regards, rhodes

Chris D

XenForo developer
Staff member
Search for $head.robots in templates; this will come up with a few templates that employ a method to push meta tags to the <head>. You basically need to do something similar.