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"
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"
n.a.
n.a.
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.
Labels |
Added:
?
|
@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?
BTW, I'm working on it: it is trivial for the home page, but a bit more tricky for other items...
thanks!
Damn wrong window
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-05-23 07:57:02 |
Closed_By | ⇒ | infograf768 |
Closed_By | infograf768 | ⇒ | joomla-cms-bot |
Build | 3.4.1 | ⇒ | staging |
Set to "closed" on behalf of @infograf768 by The JTracker Application at issues.joomla.org/joomla-cms/6923
Closing as we have a PR
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?