Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Use Cover Image for og:image meta property

Discussion in 'Showcase Closed Suggestions' started by Bob, Jan 22, 2015.

  1. Bob

    Bob Developer Staff Member

    Starting with SC 2.3.0 Beta 4 or RC 1, Showcase items no longer use the Core XF open_graph_meta template and instead will use the nflj_showcase_open_graph_meta template which will allow you to customize the OG meta to your liking.

    The og:image is now set to use the showcase item cover image as default (instead of the Forum Logo which the core xenforo template uses)

    Also, I've added the Showcase Item Description to replace using the SITE Description.

    This is the nflj_showcase_open_graph_meta template. The ONLY difference between this and core XF is that this one allows (requires) you to map in a specific og:image
    <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="{$image}" />
        <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>
    This is how you use it (this is an example from the showcase item template)
    <xen:container var="$head.openGraph">
        <xen:include template="nflj_showcase_open_graph_meta">
            <xen:set var="$url">{xen:link 'canonical:showcase', $item, 'page={$page}'}</xen:set>
            <xen:set var="$title">{$item.item_name}</xen:set>
            <xen:set var="$description">{xen:if '{$item.description}', '{$item.description}', '{xen:helper snippet, $item.message, 250}'}</xen:set>
            <xen:set var="$image">{xen:helper fullurl, $item.cover_image.thumbnailUrl, 1}</xen:set>
    Sheldon likes this.
  2. Bob

    Bob Developer Staff Member

    Here you can see the meta content as it will appear in the <head>

    The og:image is clearly linking to the showcase cover image
    The og:description is clearly using the ITEM description and not the site description.

    thelaw and alfa1 like this.
  3. alfa1

    alfa1 Active Member AMS Premium CAS Premium EMS Early Adopter IMS Premium LD Premium RMS Premium SC Premium UBS Premium

    Very nice Bob! Thanks!
    thelaw and Bob like this.
  4. Bob

    Bob Developer Staff Member

    Did the same for AMS btw (so you don't need to request is lol) :D
  5. alfa1

    alfa1 Active Member AMS Premium CAS Premium EMS Early Adopter IMS Premium LD Premium RMS Premium SC Premium UBS Premium

    yeah, I assume as much.
    Bob likes this.
  6. thelaw

    thelaw New Member AMS Premium SC Premium

    Wow.... being honest.... your addons are already stupendously great and feel like they are more like standalone products fully integrated into something else that is a forum.... Thanks for your consideration and ultra fast work.
    alfa1 and Bob like this.
  7. beanfan78

    beanfan78 Member AMS Premium SC Premium

    I know this is old, but my site is pulling nothing except the description. Not even an image so I obviously need to fix the core og, but do I need to adjust the code to show the item image? I didn't really understand this thread. I am unsure if it's a setting or I need to switch the template coding. I apologize if it's a dumb question, but I am not a coder.
  8. Bob

    Bob Developer Staff Member

    Showcase doesn't use the Core XenForo OG template, it uses it OWN (same with XFRM). Chris and I do this so that instead of the board description and the board OG image, it uses the Item Description and Item Cover Image.
  9. beanfan78

    beanfan78 Member AMS Premium SC Premium

    Thanks for the reply Bob. I will need to see why mine is not pulling an image from Showcase then. I tried to post one last night and I had to manually set the image. I will go through my settings again since this is usually something I didn't set correctly.
    Bob likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.