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

Facebook Open Graph meta codes

Discussion in 'XenForo Questions and Support' started by Gazhyde, May 1, 2013.

  1. Gazhyde

    Gazhyde Well-Known Member


    We post (or want to post) content to Facebook from Xenforo. I resolved my initial problem of not displaying images with the post, by enabling Facebook integration and then disabling it again (not sure I want Facebook logins yet). This left the meta codes in certain pages, such as messages.

    However I notice on the page code for certain parts of my site, it doesn't include the OG meta codes. For example, I have the Xen Media plug in installed. If I share a link to Facebook, or copy/paste the URL I don't get an image. Note this isn't just Xen Media (already logged it on their support area), but other core areas/add-ons don't seem get the code.

    Is there a way of editing XF so the meta codes are included every where (within reason?).

    Posting a thread:

    Posting a Xen Media link:

    Hope that make some sense?!

    Thanks, Gary
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Which default pages are not pulling an image?
  3. Gazhyde

    Gazhyde Well-Known Member


    Here is one which doesn't. OK, so you wouldn't want to post this anyway - http://zroadster.org/forum/members/. But if you choose a member which has not set privacy it does - http://zroadster.org/forum/members/_-z3.89/

    I guess what I'm trying to ask is whether the code is selectively added on certain pages, and where it's not included, how I can include it! The Xen Media example I used is one of the most likely links to be posted to Facebook.

  4. Brogan

    Brogan XenForo Moderator Staff Member

    Well for the members page there's nothing to pull really so all you would see is the default og logo.
    You can add the og tags if you wish by editing the template.

    This is how it appears in the member_view template:
    <xen:container var="$head.openGraph"><xen:include template="open_graph_meta">
        <xen:set var="$url">{xen:link 'canonical:members', $user}</xen:set>
        <xen:set var="$title">{$user.username}</xen:set>
        <xen:set var="$avatar">{xen:helper avatar, $user, 'm', '', 'true'}</xen:set>
        <xen:set var="$ogType">profile</xen:set>
        <xen:set var="$ogExtraHtml">
            <meta property="profile:username" content="{$user.username}" />
            <xen:if is="{$user.gender}"><meta property="profile:gender" content="{$user.gender}" /></xen:if>
    And the forum_list template:
    <xen:container var="$head.openGraph">
        <xen:include template="open_graph_meta">
            <xen:set var="$url">{xen:link 'canonical:index'}</xen:set>
            <xen:set var="$title">{$xenOptions.boardTitle}</xen:set>
            <xen:set var="$ogType">website</xen:set>
    For any add-ons, it's up to the developer to add it to their templates.
    You could try asking them.
  5. Gazhyde

    Gazhyde Well-Known Member

    This was probably the answer I was after I guess.

    I have posted this issue on the Xen Media Gallery site already, so will wait for a response from Chris.

    Thanks for your help!

Share This Page