?
avatar brbrbr
brbrbr
29 Mar 2016

Steps to reproduce the issue

after changing the name of an article-alias the canonical url is wrong

There is a category-blog on my site having article-urls like:

/blog/123-article-title

Now i change the alias and the url becomes:

/blog/123-better-alias

Expected result

I would expect then whenever visiting the old url the canonical in the header would be set to the new url

so when visiting /blog/123-article-title the canonical is set to /blog/123-better-alias

Actual result

however the canonical is set to something like :

/blog?catid=123&id=123:better-alias

and that url returns a 404.

Additional comments

The problem is somewhere in the router of the component in line 377 it checks whether or not the alias in the database is the same as from the slug, which isn't . So the code goes into the !advanced ( I can't find where the sef_advanced_link parameter is actually set and what is does) statement where it fetches the catid from the first segment, which is actually the article-id

avatar brbrbr brbrbr - open - 29 Mar 2016
avatar brbrbr brbrbr - change - 29 Mar 2016
The description was changed
avatar brbrbr brbrbr - change - 29 Mar 2016
The description was changed
avatar brbrbr brbrbr - change - 29 Mar 2016
The description was changed
avatar infograf768
infograf768 - comment - 29 Mar 2016

Which version of Joomla? Please test on 3.5.1 rc1. Canonical (from the SEF plugin code) has been improved to cope with extensions implementing it.

avatar brbrbr
brbrbr - comment - 29 Mar 2016

Tested on 3.5.1 RC 1 and now it simply returns the 'current' url

so
/blog/123-article-title -> canonical /blog/123-article-title
/blog/123-better-alias -> canonical /blog/123-better-alias

but these are the same pages so it should be

/blog/123-article-title -> canonical /blog/123-better-alias

The sef plugin checks for a canonical relation link set, where is that option hidden? It is not set by com_content automagicly

so it got worse - a lot - the sef plugin does not recalculate the current url for the current menu and category structure, neither does com_content.

I think this will give you wrong canonicals whenever: moving an article to a different category, renaming a category, creating a new menu for a category, changing the alias.


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

avatar infograf768
infograf768 - comment - 29 Mar 2016

The SEF plugin, if the Domain is set, will indeed just display the canonical with the new domain and the same structure. It is not a "real" canonical which can only be implemented by third party extensions.

See #9565
@andrepereiradasilva
Please look at this, as it is confusing to me.

avatar brbrbr
brbrbr - comment - 29 Mar 2016

So you condider the com_content as a third party extension?

Right, then move this topic into their bin.

In 3.5.0 the sef plugin used the router of com_content, getting the correct url ( reflecting changed to the sites structure) for most situations. The implementation in 3.5.1 RC1 is a serious step back


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

avatar SharkyKZ
SharkyKZ - comment - 29 Mar 2016

SEF plugin could never insert correct canonical URLs, which is why this functionality has been removed in 3.5.1. Now the "canonical" URL is inserted only when canonical domain is set. It's better to have no canonical than a wrong one that even changes based on accessed URL.

What infograf meant, you can use a third party plugin to insert canonical URLs. You can also do this in template override. If the team agreed, canonicals could be inserted by components. But that's up to them to decide. Maybe the idea was to have a single plugin insert canonicals, IDK.

avatar andrepereiradasilva
andrepereiradasilva - comment - 29 Mar 2016

The problem was that in 3.5.0, i think by mistake, Joomla was generating canonical URI trough the SEF plugin when no alternative domain is typed.

The following PR (#9565) corrects, among other things, that.

There is a problem with Joomla regarding generation of canonical URI, it has to be made at component level.
That problem will make you could have an infinite number of canonical URIs for the same page.
More information is in that PR comments.

i see @SharkyKZ already explained that better :)

avatar infograf768
infograf768 - comment - 29 Mar 2016

As far as I know, when the domain was indicated in the SEF plugin field, the canonical was always the same URL (except the domain) as the present url. Changing an alias would change both the base href and the canonical.

The problem was that in 3.5.0, i think by mistake, Joomla was generating canonical URI trough the SEF plugin when no alternative domain is typed.

That was also the case in 3.4.8, and in fact for a long time.

As I wrote above, real canonicals i.e. indicating a unique canonical for all URL instances loading the same page is NOT implemented in Joomla core.

avatar SharkyKZ
SharkyKZ - comment - 29 Mar 2016

The URL inserted was $domain . JRoute::_('index.php?' . http_build_query($router->getVars()), false); which isn't necessarily the same as current URL (JUri::getInstance()), but also incorrect.

avatar andrepereiradasilva
andrepereiradasilva - comment - 29 Mar 2016

That was also the case in 3.4.8, and in fact for a long time.

Just checked the SEF plugin history, Joomla is in fact inserting fake canonical for some time now.

avatar andrepereiradasilva
andrepereiradasilva - comment - 29 Mar 2016

@SharkyKZ

[...]You can also do this in template override. [...]

Actually i think in 3.5.1 RC you just need to add, in the SEF plugin canonical domain field, the same domain URI as your site (e.g. https://www.example.com) and Joomla will put the fake canonical URI, that, in fact, will be the current URI. But i see no point in doing this.

avatar brbrbr
brbrbr - comment - 29 Mar 2016

No, joomla 3.5.1 RC will simply take the current wrong url and replace the domain name.

so http://example.com/blog/123-wrong-alias gets http://www.example.com/bolg/123-wrong-alias.

I needed about 4 lines of code into the default.php of the article view to get the correct canonical into the head.

A correct canonical to reflect site structure changes should be in the core of any joomla component, should have been there from the first day the canonical tag popped up.


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

avatar andrepereiradasilva
andrepereiradasilva - comment - 29 Mar 2016

No, joomla 3.5.1 RC will simply take the current wrong url and replace the domain name.

I know. That's what i said.

avatar infograf768
infograf768 - comment - 31 Mar 2016

I guess this can be closed.

avatar andrepereiradasilva
andrepereiradasilva - comment - 2 Apr 2016

@brianteeman i think you can close this

avatar infograf768 infograf768 - change - 4 Apr 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-04-04 10:57:56
Closed_By infograf768
avatar joomla-cms-bot joomla-cms-bot - close - 4 Apr 2016
avatar infograf768
infograf768 - comment - 4 Apr 2016

Add a Comment

Login with GitHub to post a comment