vistamedia / socialmeta

Facebook open graph and Twitter cards for Joomla! articles and FLEXIcontent items
21 stars 9 forks source link

Wrong "og:locale" with the Joomla core : System – Language Code #6

Closed gagnonjeanfrancois closed 8 years ago

gagnonjeanfrancois commented 8 years ago

Hi,

SocialMeta use for "og:locale" the default language of the site, but should take consideration the alternative code language when the plugin « System – Language Code » is activated.

To reproduce : This does not need to be tested on a multilang site. Test instructions: 777d5fc2-1cd5-11e6-9729-44315f0eda69

Edit the System Language Code plugin and enable it, save. After save, a new tab "Language Codes" will show. Enter fr-CA for example (if your default site language is fr-FR)

Display an article in frontend and look at source:

Instead of <meta property="og:locale" content="fr_FR"> we should get get <meta property="og:locale" content="fr_CA">

Yes I'm lazy I just copy past this pull request with litle modification.

This could help to create a fix : https://github.com/joomla/joomla-cms/blob/staging/plugins/system/languagecode/languagecode.php

To understand to role of this core plugin https://joomlaseo.com/blog/multilingual-seo-in-joomla (take a look at this paragraphe "System – Language Code") http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=27390

vistamedia commented 8 years ago

Indeed, it could be considered as a bug. I will study that carefully with my friend Jean-Marie Simonet to see if I should send a pull request to Joomla languagecode plugin or modify my own code. But it seems that the purpose of the languagecode plugin is to search and replace the code wherever it is. Now the itemprop inLanguage has direct effect on SEO but I think meta og:locale has absolutely no effect. It's purpose according to Facebook is to provide the right translation... I will fix it anyway on socialmeta but I think it would be wise to modify it also in plg_system_languagecode.

MATsxm commented 8 years ago

@vistamedia It seems to be with https://github.com/joomla/joomla-cms/pull/10542 :wink:

vistamedia commented 8 years ago

It's fixed for socialmeta ;) I will commit later because I finally decided to add the google structured data as well ;) https://developers.google.com/search/docs/data-types/articles#article_types

gagnonjeanfrancois commented 8 years ago

Hi,

@MATsxm The long story, yesterday I was testing SocialMeta and I find out that

<meta itemprop="inLanguage" content="en-FR">
<meta property="og:locale" content="fr_FR">

Should look like this :

<meta itemprop="inLanguage" content="en-CA">
<meta property="og:locale" content="fr_CA">

when : "System – Language Code" is enabled

So I did a report https://github.com/joomla/joomla-cms/issues/10540 and Jean-Marie Simonet have made the fix with a clearer report (if you look carefully, you'll see that I'm showing my source in the first post when I'm saying that I'm lazy).

I did report, « meta itemprop="inLanguage" » to the Joomla programmer, but I didn't report, « meta property="og:locale" » because Joomla doesn't use Open Graph.

@vistamedia Because Joomla! doesn't support Open Graph, I think it's your plugin that need to integrate this function. But maybe I'm wrong, @infograf768 could definitely tell us.

@vistamedia I think meta og:locale has absolutely no effect

Well, I can't prove that it has an significatif impact, but I can't tell the opposite... I try to dig deeper and find out that Facebook has a strong list of languages for "og:locale" : https://www.facebook.com/translations/FacebookLocales.xml and in this page it's said.

People can choose the language they see when they're on Facebook. They'll see Facebook text strings in the language of their own locale, along with the text strings for any Social Plugins you've added to your app or website. For localization to work for Social Plugins be sure you use the correct locale code when you add the plugins.

Alors voilà... Hope that I have been enough clear.

I wish you a Bonne soirée :)

vistamedia commented 8 years ago

I just committed the fix. If you wish to update easily, you can configure the update channel to "beta" and it will always ask you to update with the latest snapshot. Please confirm it's working and close the issue ;)

gagnonjeanfrancois commented 8 years ago

I've tested the og:locale and it's working fine! Thanks :D