1. 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?

Discussion in 'XenForo Development Discussions' started by rhodes, Jul 16, 2016.

  1. rhodes

    rhodes Active Member

    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
     
  2. Chris D

    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.
     
    rhodes likes this.
  3. rhodes

    rhodes Active Member

    Thank you @Chris D - this information is very helpful.
     

Share This Page