I did install latest 3.4.0b3
when browsing to http://dev.bizgo.nl/category-test/1-art-test.html there is no canonical set as one would expect.
However when addressing same page as http://dev.bizgo.nl/category-test/1 the canonical shows:
<link href="http://dev.bizgo.nl/category-test.html?id=1" rel="canonical" />
Instead of expected
<link href="http://dev.bizgo.nl/category-test/1-art-test.html" rel="canonical" />
Meaning when unlucky one will have three pages indexed.... as duplicates.... :(
This is on a vanilla Joomla 3.4.0b3,
public $sef = '1';
public $sef_rewrite = '1';
public $sef_suffix = '1';
public $unicodeslugs = '0';
public $sitename_pagetitles = '0';
.htaccess set.
apache 2.2.15
php 5.4.16
How can this be addressed?
Thanks!
Labels |
Added:
?
|
Category | ⇒ | Router / SEF |
I'd love to support..... I am not that familiar with how it works here (I am a github.com noob) tell me which ones and how to promote.. Tx!
Labels |
Removed:
?
|
Labels |
Added:
?
|
Can someone explain why the plugin code for rel canonical is comparing an absolute URL with a relative ?
$router = $app::getRouter();
$uri = JUri::getInstance();
$domain = $this->params->get('domain');
if ($domain === null || $domain === '')
{
$domain = $uri->toString(array('scheme', 'host', 'port'));
}
$link = $domain . JRoute::_('index.php?' . http_build_query($router->getVars()), false);
if ($uri->toString() !== $link)
{
$doc->addHeadLink(htmlspecialchars($link), 'canonical');
}
thus
if ($domain === null || $domain === '') {...}
is not executed and this
if ($uri->toString() !== $link)
is comparing an absolute URL with a relative
is this done deliberately ? is this what we want the plugin to do ?
can someone explain what is the intention of code:
if ($domain === null || $domain === '') {...}
why is not ?:
if ($domain == '') {...}
I can confirm that this bug still exist on Joomla 3.4.8.
We have modified the code in 3.5.0
I have still issues with the sef plugin, also in 3.5.0 . When I add $domain === null
($domain is null when I never saved the plugin config) the comparision is done between absolute urls and fixes the problem:
if ($domain === null || $domain === false || $domain === '') {...}
@elpescador-nl Are you suggesting a fix?
That code J3.5.0 code, no longer exists in J3.5.1+, comment is no longer valid,
the issue is fixed in J3.5.1 ,
I think this can be closed
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-05-19 15:39:51 |
Closed_By | ⇒ | roland-d |
This is a known bug in Joomla for the last several years. I proposed a change a few months ago where the canonical tag is only included if the current page is not the canonical URL, which is how it is supposed to be according to Google. That change was accepted. Without that change, you would have the same situation as now, just that the "right" page would have the canonical tag, too. Which again is wrong by Googles own definition of the canonical tag.
If you want to solve this issue, help by supporting my routing related PRs. They are moving towards that and try to solve the issue.