Install latest stable Joomla version
Setup multilanguage
Create two menu items
Visiting the Greek URL https://www.domain.com/el/είσοδος-χρηστών
I get in HTML source code
<link href="https://www.domain.com/el/είσοδος-χρηστών" rel="alternate" hreflang="el-GR" />
<link href="https://www.domain.com/en/είσοδος-χρηστών" rel="alternate" hreflang="en-GB" />
Visiting the English URL https://www.domain.com/en/login
I get in HTML source code
<link href="https://www.domain.com/el/login" rel="alternate" hreflang="el-GR" />
<link href="https://www.domain.com/en/login" rel="alternate" hreflang="en-GB" />
In both cases it should yield
<link href="https://www.domain.com/el/είσοδος-χρηστών" rel="alternate" hreflang="el-GR" />
<link href="https://www.domain.com/en/login" rel="alternate" hreflang="en-GB" />
Tested using Joomla 3.6.4 on Debian 8 and php 5.6.27
I don't know if it helps at all but using xdebug I tried to troubleshoot a bit and I reached file
libraries/cms/router/site.php
near line 496:
// Build the component route
$component = preg_replace('/[^A-Z0-9_\.-]/i', '', $query['option']);
$tmp = '';
$itemID = !empty($query['Itemid']) ? $query['Itemid'] : null;
$crouter = $this->getComponentRouter($component);
$parts = $crouter->build($query);
$result = implode('/', $parts);
$tmp = ($result != "") ? $result : '';
Debugging in english language at this point of execution $itemID in my case was 676 which is the Greek menu itemID, however after executing $crouter->build($query)
the $query['Itemid'] is changed to 693 which is the english language menu itemID.
Consequently it's using $query['itemId']
to build the path to my knowledge.
Any idea why else this might be happening? Thanks in advance
PS: Same thing happes if I create a menu item for password reset, username reminder, registration etc etc.
Labels |
Added:
?
|
Category | ⇒ | Multilanguage Router / SEF |
Hmm...
Tested on staging and indeed I have the same issue. No need to set the menu items to hidden
to see the result.
I saw this on the downloads site too when the menu item aliases had the language code in them (i.e. login-fr or login-us) for the login page. I just changed all the aliases to be 'login' for all languages to "fix" it.
Associations work fine and with correct urls as long as we use the switcher.
But the alternate is created in the languagefilter plugin in the onAfterDispatch()
method and it chokes on these.
The issue looks indeed related to JRoute() and com_users.
https://github.com/joomla/joomla-cms/blob/staging/plugins/system/languagefilter/languagefilter.php#L777
The content of the JRoute here is totally correct. But once passed through JRoute() we get indeed the wrong url.
Hi, yes the menutype / name doesn't matter in this case. I've tried moving them around/ recreating in other menus to see if it had an effect but it seems the issue only occurs to com_users urls. I haven't noticed it in any other menu items I created.
Hi,
it worked OK in my case and fixed the 404 from rel="alternate" on login. I will try and check if anything else was affected.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-12-10 09:56:44 |
Closed_By | ⇒ | infograf768 |
Closed_By | infograf768 | ⇒ | joomla-cms-bot |
Closing as we have a patch.
@ioweb-gr
Tests should be done on a patched staging branch, not on 3.6.4 as we also corrected some login issues in staging
Please add comments and test on
https://issues.joomla.org/tracker/joomla-cms/13152
Set to "closed" on behalf of @infograf768 by The JTracker Application at issues.joomla.org/joomla-cms/13142
can you please test on staging and give some more details, like where you place these menu items = which menutype.