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

XF 1.4 Facebook posting - Auto complete article image

LogOn

Active member
#1
Hello,

I need to set an option that allows facebook to "autofill" the article first photo - all software i used before have this option by default (per example, wordpress). In this moment, when i'm posting a article link on my facebook page, i have the following box:

Capture.JPG

More specifically: i don't want to change de default facebook image, i'v already done that. I want facebook and social networks to automatically fill the post with the first photo.

Why do i need it to autofill the article photo? Because i have a program that automatically posts on facebook articles that i want, but this program can't work this way.

My website is http://www.recomandare.net/
 

Mike

XenForo developer
Staff member
#2
There isn't anything in XF that picks the image out of the first post. At best, you could remove the image related parts from the open_graph_meta template and see if FB picks the image you want automatically.
 

LogOn

Active member
#3
Thank's Mike!

My open_graph_meta template has this code only:

Code:
<xen:if is="{$xenOptions.facebookAppId} OR {$xenOptions.facebookAdmins}">
    <meta property="og:site_name" content="{$xenOptions.boardTitle}" />
    <xen:if is="{$avatar}"><meta property="og:image" content="{$avatar}" /></xen:if>
    <meta property="og:image" content="{xen:helper fullurl, @ogLogoPath, 1}" />
    <meta property="og:type" content="{xen:if $ogType, $ogType, article}" />
    <meta property="og:url" content="{xen:raw $url}" />
    <meta property="og:title" content="{xen:raw $title}" />
    <xen:if is="{$description}"><meta property="og:description" content="{xen:raw $description}" /></xen:if>
    {xen:raw $ogExtraHtml}
    <xen:if is="{$xenOptions.facebookAppId}"><meta property="fb:app_id" content="{$xenOptions.facebookAppId}" /></xen:if>
    <xen:if is="{$xenOptions.facebookAdmins}"><meta property="fb:admins" content="{xen:helper implode, {$xenOptions.facebookAdmins}, ','}" /></xen:if>
</xen:if>
I'v tried to erase the parte with image, but it has no efect. If i erase all the code within the template, my facebook post acts like this (this is if i leave the "Facebook Open Graph Logo" blank - if not, it takes my facebook logo):
Capture1.JPG

What is more bizar, is that linkedin is extracting the first image of the article automatically:
Capture2.JPG
 

Mike

XenForo developer
Staff member
#4
Without the og:image parts (there are two lines that have it there, BTW), it's really down to what FB decides to do based on its own algorithms (hence why LinkedIn handles it differently). If you want to add anything to the open_graph tags, you'll need an add-on.