?
avatar pieter-groeneweg
pieter-groeneweg
12 Feb 2015

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!

Votes

# of Users Experiencing Issue
3/3
Average Importance Score
4.33

avatar pieter-groeneweg pieter-groeneweg - open - 12 Feb 2015
avatar joomla-cms-bot joomla-cms-bot - change - 12 Feb 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 12 Feb 2015
Category Router / SEF
avatar Hackwar
Hackwar - comment - 16 Feb 2015

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.

avatar pieter-groeneweg
pieter-groeneweg - comment - 23 Feb 2015

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!

avatar brianteeman brianteeman - change - 25 Feb 2015
Labels Removed: ?
avatar brianteeman brianteeman - change - 25 Feb 2015
Labels Added: ?
avatar ggppdk
ggppdk - comment - 22 Aug 2015

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');
}
  • if you save SEF plugin once, you get into the parameters: domain:false

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 == '') {...}

avatar fititnt
fititnt - comment - 17 Feb 2016

I can confirm that this bug still exist on Joomla 3.4.8.


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

avatar infograf768
infograf768 - comment - 2 Mar 2016

We have modified the code in 3.5.0

avatar elpescador-nl
elpescador-nl - comment - 23 Mar 2016

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 === '') {...}

avatar roland-d
roland-d - comment - 19 May 2016

@elpescador-nl Are you suggesting a fix?


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

avatar ggppdk
ggppdk - comment - 19 May 2016

@roland-d

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 ,

  • the SEF plugin can never guess what the canonical URL should be, so no canonical is added at all, so it is now the current URL, unless component decides otherwise
  • the SEF plugin will only care to fix the alternative domain ... please read the initial posting of this PR, and all of the postings to know more:

#9565

I think this can be closed

avatar roland-d
roland-d - comment - 19 May 2016

@ggppdk Thank you for your comment. Closing this now, it can always be reopened if needed.

avatar roland-d roland-d - close - 19 May 2016
avatar roland-d roland-d - change - 19 May 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-05-19 15:39:51
Closed_By roland-d

Add a Comment

Login with GitHub to post a comment