1. REGISTRATION REQUIREMENTS:

    Register with your xenforo.com Username then 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.

Implemented Use Gallery images for og:image meta property

Discussion in 'Showcase Closed Suggestions' started by mouth, Mar 3, 2014.

  1. mouth

    mouth Member CAS Premium RMS Premium SC Premium UBS Premium Sportsbook

    Requesting that Showcase pages include the opengraph meta properties. Eg.
    HTML:
        <meta property="og:site_name" content="Site" />
           <meta property="og:image" content="http://site.com/styles/site/Logo.og.png" />
        <meta property="og:type" content="website" />
        <meta property="og:url" content="http://site.com/forum/" />
        <meta property="og:title" content="Site" />
        <meta property="og:description" content="Site Description" />
           <meta property="fb:app_id" content="5551234" />
        <meta property="fb:admins" content="5551234" />
    XF standard functionality automatically includes them in XF generated pages, eg. /forum/
     
    Last edited: Oct 2, 2017
  2. Bob

    Bob Developer Staff Member

    The ITEM template already has it. I use the same exact (cut and paste) from the Resource Manager.

    HTML:
    <xen:container var="$head.openGraph">
        <xen:include template="open_graph_meta">
            <xen:set var="$url">{xen:link canonical:showcase, $item}</xen:set>
            <xen:set var="$title">{$item.item_name}</xen:set>
        </xen:include></xen:container>
     
  3. Bob

    Bob Developer Staff Member

    This is how a THREAD maps to it..
    HTML:
    <xen:container var="$head.openGraph"><xen:include template="open_graph_meta">
    
            <xen:set var="$url">{xen:link 'canonical:threads', $thread}</xen:set>
            <xen:set var="$title">{xen:helper threadPrefix, $thread, escaped}{$thread.title}</xen:set>
            <xen:set var="$description">{xen:helper snippet, $firstPost.message, 155}</xen:set>
            <xen:set var="$avatar">{xen:helper avatar, $thread, m, 0, 1}</xen:set>
        </xen:include></xen:container>
    This is how the Resource Manager maps to it
    HTML:
    <xen:container var="$head.openGraph">
        <xen:include template="open_graph_meta">
            <xen:set var="$url">{xen:link canonical:resources, $resource}</xen:set>
            <xen:set var="$title">{xen:helper resourcePrefix, $resource, escaped}{$resource.title}</xen:set>
        </xen:include></xen:container>
    This is how Showcase maps to it
    HTML:
    <xen:container var="$head.openGraph">
        <xen:include template="open_graph_meta">
            <xen:set var="$url">{xen:link canonical:showcase, $item}</xen:set>
            <xen:set var="$title">{$item.item_name}</xen:set>
        </xen:include></xen:container>
    The only difference is that THREAD is mapping in a description by taking a snippet of the first post and also passing in the Thread Starters Avatar.

    This is the openGraph template itself (so you can see what can actually be mapped in and what is grabbed from core XF options (like board title)
    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="{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>
     
  4. mouth

    mouth Member CAS Premium RMS Premium SC Premium UBS Premium Sportsbook

    OK, thanks. Just not the showcase homepage (eg. http://netrider.net.au/showcase/ ). I didn't look beyond there, apologies.
    For the item template, would be great to also add in the meta property for image and picking up the first (or latest) image that the user has added to their item. That way Facebook will display their image instead of the site logo.
    Thanks.
     
  5. Bob

    Bob Developer Staff Member

    I THINK (I'd have to do some digging) that I did a custom openGraph template for someone. I don't "DO" facebook, so once I get this new release out, maybe you and BamaStangGuy can help me test some stuff pertaining to this.
     
  6. mouth

    mouth Member CAS Premium RMS Premium SC Premium UBS Premium Sportsbook

    Happy to help :)
     
    Bob likes this.
  7. Bob

    Bob Developer Staff Member

    Added this to SC 2.3.0 (will be available starting with Beta 4 or RC 1)
     
    alfa1 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.