Facebook Open Graph meta codes

Gazhyde

Well-known member
Hi,

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:
facebookog1.webp

Posting a Xen Media link:
facebookog2.webp

Hope that make some sense?!

Thanks, Gary
 
Brogan,

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.

Gary
 
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:
Code:
<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>
    </xen:set>
</xen:include></xen:container>

And the forum_list template:
Code:
<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>
    </xen:include></xen:container>

For any add-ons, it's up to the developer to add it to their templates.
You could try asking them.
 
For any add-ons, it's up to the developer to add it to their templates.
You could try asking them.
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!
 
Top Bottom