?
avatar Simonkloostra
Simonkloostra
12 May 2015

Steps to reproduce the issue

Any mulilingual site, observe the source code. The source code shows a URL with a rel="alternate" metatag for the corresponding page of the alternative language. So, if the page is bilingual (say, english and dutch) and the current URL is an English one (say: http://example.com/en/current-english-article), only a reference to the Dutch page is shown, like this:
link href="http://example.com/nl/dutch-article" rel="alternate" hreflang="nl-NL"

Expected result

Google requires the actual page you are on to also have a metatag rel="alternate" pointing to itself with the current language, like this:
link href="http://example.com/en/current-english-article" rel="alternate" hreflang="en-GB"
link href="http://example.com/nl/dutch-article" rel="alternate" hreflang="nl-NL"

Actual result

n.a.

System information (as much as possible)

n.a.

Additional comments

This is according to the official Google Webmaster guidelines at https://support.google.com/webmasters/answer/189077?hl=en:

"If you have multiple language versions of a URL, each language page must identify all language versions, including itself."

By the way: This is the first time I am reporting an issue here, so forgive me if me if I reported this incorrectly.

avatar Simonkloostra Simonkloostra - open - 12 May 2015
avatar joomla-cms-bot joomla-cms-bot - change - 12 May 2015
Labels Added: ?
avatar smz
smz - comment - 16 May 2015

You're right. I think I know what should be modified and I'll probably propose a PR to fix this...

Unrelated: when creating example URLs, please use the example.(com | net | org) domains. Your URLs are redirect to an existing commercial domain (salesforce.com). Fix, if you can...

@infograf768, can you please have a look at this and give an opinion?

avatar dgt41
dgt41 - comment - 16 May 2015

@smz Here is some code I use in my custom head.php that might be handy:

        $languages = JLanguageHelper::getLanguages();
        foreach ($languages as $item=>$value)
        {
            if (JFactory::getLanguage()->getDefault() == $value->lang_code)
            {
                $buffer .= '<meta property="og:locale" content="' . htmlentities($value->lang_code, ENT_HTML5, 'UTF-8') . '" />';
                unset($languages[$item]);
            }
            else
            {
                $buffer .= '<meta property="og:locale:alternate" content="' . htmlentities($value->lang_code, ENT_HTML5, 'UTF-8') . '" />';
            }
        }

This will produce the meta open graph for locale, change the go:locale:alternate to alternate is all you need?

avatar smz
smz - comment - 16 May 2015

@dgt41 That might work, but I think the correct place where to fix this behavior is PlgSystemLanguageFilter::onAfterDispatch()

avatar dgt41
dgt41 - comment - 16 May 2015

@smz Yeap, that’s the place! I use this in head because joomla doesn’t set any open graph metas by default. Of course for the ones that are already done by J you have to change the behavior in the respected place!

avatar smz
smz - comment - 16 May 2015

BTW, I'm working on it: it is trivial for the home page, but a bit more tricky for other items...

avatar dgt41
dgt41 - comment - 16 May 2015

@smz If you need any help just Skype me!

avatar smz
smz - comment - 16 May 2015

:+1: thanks!

avatar smz smz - reference | 5544b0c - 16 May 15
avatar smz
smz - comment - 16 May 2015

@dgt41 have a look at #6963...

avatar dgt41
dgt41 - comment - 16 May 2015

@test OK with a minor thing that needs some attention
screen shot 2015-05-16 at 5 32 52

Try some article that has "*" all languages as selected language, the produced code is invalid (star is not a language!) Maybe a simple check if...

avatar smz
smz - comment - 16 May 2015

Ooops! Wiil fix...
(please, further comments in #6963)

avatar dgt41
dgt41 - comment - 16 May 2015

Damn wrong window ????

avatar dgt41
dgt41 - comment - 16 May 2015

@tesk OK here! Thanks Sergio!

avatar Simonkloostra Simonkloostra - change - 18 May 2015
The description was changed
avatar smz
smz - comment - 22 May 2015

I think this can be closed as we have #6963 fixing this issue...

avatar infograf768 infograf768 - change - 23 May 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-05-23 07:57:02
Closed_By infograf768
avatar joomla-cms-bot joomla-cms-bot - change - 23 May 2015
Closed_By infograf768 joomla-cms-bot
Build 3.4.1 staging
avatar joomla-cms-bot joomla-cms-bot - close - 23 May 2015
avatar infograf768
infograf768 - comment - 23 May 2015
avatar infograf768
infograf768 - comment - 23 May 2015

Closing as we have a PR


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6923.

Add a Comment

Login with GitHub to post a comment