Topic-icon JFBConnect Overwrites Canonical URLs

Active Subscriptions:

None
11 years 1 month ago - 11 years 1 month ago #52864 by toby07801
Hey guys, just noticed that the Opengraph component of of JFB Connect seems to overrule the Canonical URL to my content that I have specified in some Joomla extensions due to the fact that there are often multiple paths possible to the same content which can result in different URLs. If a user likes one URL and the content is accessed via the different path then the like would not show. To prevent this I have added the canonical tag and also made this canonical url the og:url tag for facebook. (Facebook by default uses the canonical as the default url if this is specified)

Since installing your extension the og:url is no longer the canonical url, your component seems to overwrite it with whatever the current url is instead.

So I've had to add og:url to the list of exceptions in the configuration and that re-enables my canonicals, however I think this is bad design and bad for SEO and you should probably modify your extension to check first if a canonical url has been specified and use that one as the og:url to stop duplicate urls being used by facebook for aggregation of likes, comments and shares.

Otherwise I have yet to find a fault with the component, great work and easy to use!
Last edit: 11 years 1 month ago by toby07801.
The topic has been locked.
Support Specialist
11 years 1 month ago #52866 by alzander
Toby,
First, well done for understanding canonical links, og:url tags, and all the other stuff that goes into SEO. Seriously, you're one of the few that gets it.

With that said, JFBConnect is designed for admins that don't have all that knowledge and meant to work with SEO extensions that flat out get it all wrong. Our og:url handler does a lot of effort to find the 'best' URL for a page. So, if you're in a Joomla article, we don't just use the current URL, we'll use a canonical URL for all the various URLs that Joomla could create. In all honesty, our og:url tag may not be the URL you expect (though we try).. but, it will always be the same whenever an article is visited, which is the most important thing to make sure that your Like count isn't spread out amongst many different pages.

The above works for 99.999% of users because they don't understand (or even want to know what) a canonical URL is. It's our job to make things simpler in that regard.

Unfortunately, many extensions (and Joomla itself) insert the rel="canonical" tag without any regard for actually determining a canonical URL. Most of the time, they just use the current URL. JFBConnect does a bit of work within Joomla (to pick a menu item, category, etc) and even outside Joomla (stripping Google analytics tracking tags, etc) to get a URL that doesn't cause too many problems.

Whew... with all that said, we don't have an option to disable our og:url behavior. However, you can disable our og:url behavior in general by editing the /libraries/sourcecoast/OpenGraph.php file. Around line 240, you'll see:
$url = OpenGraphUtilities::getCurrentUrlTag();
        $this->addDefaultGraphTag('og:url', $url, PRIORITY_NORMAL);
Comment both those lines out by adding // in front of them.

If you're using our Open Graph plugins for Joomla content or other extensions, a very good og:url tag will still be added. For the rest of your pages/extensions, we'll leave them alone, which may be what you're after.

I hope that helps explain and get you going, but if you have any feedback or suggestions on how to improve things, we're always listening.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 1 month ago #52872 by toby07801
Wow, thanks for the detailed response. That all makes sense and I do agree that the most critical aspect of canonicals is to have a single consistent url to the content, even if that may not be the properly formatted one.

My website is mostly an image gallery, I use Joomgallery with over 40,000 photos and hundreds of categories. A typical image is normally part of at least two subcategories and so the proper url to content should always list the categories like "/gallery/cat_1/cat_2/image_id". Unfortunately with Joomgallery it doesn't really seem to matter what you type into the url, it always just uses the last part of it to get to an image so it is possible to use just "gallery/image_id" which strips off the correct page headings and other things that come with going via the preferred path. This shorthand url was what JFBconnect started using as the og:url instead of the canonical.

I noticed that you suggested I comment out some code in your reply to "disable your og:url behaviour". - I already have got the originally specified og:url working again by adding og:url to the "Skip Tags" setting in /administrator/index.php?option=com_jfbconnect&view=opengraph&task=settings

What's the difference with doing that or doing what you suggested above?
The topic has been locked.
Support Specialist
11 years 1 month ago #52878 by mel
The code that Alex mentioned to comment out is for when JFBConnect attempts to set the og:url tag if there is nothing else in our code that is setting that tag. For instance, if you include an SCOpenGraph easy-tag on the page to set the url, it will still work in this case. Also, some of our Open Graph plugins (such as for EasySocial and JomSocial) will attempt to set the og:url tag specific to those extensions.

Using the Skip Tags setting will block JFBConnect from adding the og:url tag to the page in any of the above cases (our plugins, easy-tags, defaults and attempting to auto-generate values if no og:url is present). If using this setting is working for you, then I'd suggest using that, as you won't lose any changes if you upgrade.

-Melissa
The topic has been locked.