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

Discussion in 'XenForo Questions and Support' started by LogOn, Jun 3, 2015.

  1. LogOn

    LogOn Active Member


    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:


    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/
  2. Mike

    Mike XenForo Developer Staff Member

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

    LogOn Active Member

    Thank's Mike!

    My open_graph_meta template has this code only:

    <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>
    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):

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

    Mike XenForo Developer Staff Member

    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.
    LogOn likes this.
  5. LogOn

    LogOn Active Member

    @Mike , erasing both lines with og:image worked perfectly! Now facebook is taking the first photo when posting. Thank you!

Share This Page