Topic-icon JFBConnect not tagging our JEvents content

Active Subscriptions:

None
5 years 6 months ago #64676 by RIadmin
I've just installed JFBConnect today, so I have a lot to learn... the way of connecting to one's Facebook App is very sophisticated, yet... some things are driving me crazy.

Meta description
I was planning to fill in the meta-descriptions of all our pages so JFBConnect could pick those up and translate them into <meta property="og:description" content="..."> tags. That's working fine in articles, but not happening with categories and events managed in our events component, JEvents. It seems I have to RE-ADD the description inside a {SCOpenGraph description=...} tag in the content.

Meta image
Same problem with the og:image in JEvents categories and events. It's not picking up the first image on the page, but substitutes the site default image instead.

Looking at this docs page - www.sourcecoast.com/jfbconnect/docs/open-graph/tags-for-joomla - under Open Graph Plugins, says "The image used on Facebook will be set to the first image found in the article." but I've found that is not working in JEvents - which contains crucial content.

Why absolute URLs for images?
If I have to work around that by placing per-page override tags like {SCOpenGraph image=http://domain.com/betterimage.jpg}, in all our events content, why must I input the image URL as an absolute URL? I consider it best practice to use site-root-relative URLs. If we ever need to change domains, it means NO WORK fixing internal links. If I have to hand-add image URLs tags INTO ALL OUR EVENTS CONTENT, then why can't your code at least at check if the URL doesn't start with http and, if it doesn't, prepend the site address... that would be so much more portable.

So,in brief, 2 questions:
1) Is there a way that I can get JFBConnect to read the meta descriptions and images from JEvents categories and events?
2) If not, is there a way to specify the image URL without being literal about the site address?

Hoping you can help me figure this out soon!
Vicki
The topic has been locked.
Support Specialist
5 years 6 months ago #64678 by alzander
A lot of your issues resolve around JEvents. We don't have an Open Graph plugin for JEvents, which means the default Open Graph behavior will be used for any of your JEvents pages:
Meta Description
By default, JFBConnect should take the meta description set for any page and use that as the Open Graph Description tag. If you're using an extension that we have an Open Graph plugin for, then there are different options for how the og:description tag can be generated. Since we don't have an Open Graph plugin for JEvents, the only way to override or set your own og:description would be through the {SCOpenGraph description=...} tag.

Meta Image
JFBConnect can't determine the best image to use for extensions it doesn't understand. It's impossible to use the first image we see on a page (or content area) as many times, that will be an icon or other irrelevant image. The purpose of Open Graph plugins are to give hints to JFBConnect as to the best title, description or image to use for the current type of page for an extension. Since we don't have a plugin for JEvents, you'd need to set the {SCOpenGraph image=...} tag to tell JFBConnect which image should be set when the current event (or user or any other type of page) is shown.

Why absolute URLs for images?
An absolute URL is required by Facebook and Twitter for the image and therefore, our SCOpenGraph tag has always required a full URL as well. We've never had the request for, or even considered, making the {SCOpenGraph image=..} tag work with a relative URL. It's a good idea though, so we looked into it this morning to get the code worked up for it.

To implement, please edit the /libraries/sourcecoast/OpenGraph.php file. Around line 395, you'll see:
}

            // Basic Twitter Card support
Sandwich this code between those 2 lines:
// Check and set the base URL for images if a relative path is given
            if ($this->name == 'og:image')
            {
                if (strpos($tagValue, 'http') !== 0)
                {
                    $tagValue = JUri::root() . ltrim($tagValue, '/');
                }
            }
From our testing, that seems to work, and we don't see any negative effects. We'll continue to test, but would love to have your feedback. This will likely go in the next release (once we're confident in it), so you won't have to keep implementing this change going forward.

Thanks for helping improve JFBConnect!
Alex
The topic has been locked.