• REGISTRATION REQUIREMENTS:

    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

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
HTML:
<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>
</xen:if>

This is how you use it (this is an example from the showcase item template)
HTML:
<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>
    </xen:include>
</xen:container>
 
Upvote 1
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.

Selection_669.png
 
yeah, I assume as much.
 
  • Like
Reactions: Bob
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.
 
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.
 
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.
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.
 
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.

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.
 
  • Like
Reactions: Bob
Back
Top