• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

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

rhodes

Active member
#1
Hello,

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
#2
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.