Last modified: 2011-03-13 18:04:30 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T23173, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 21173 - Provide rel="canonical" for funky URL parameters and other things beyond redirects
Provide rel="canonical" for funky URL parameters and other things beyond redi...
Status: RESOLVED WONTFIX
Product: MediaWiki extensions
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-18 19:49 UTC by Jools Wills
Modified: 2011-03-13 18:04 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
diff file for with fixes (1.03 KB, patch)
2009-10-18 19:51 UTC, Jools Wills
Details

Description Jools Wills 2009-10-18 19:49:32 UTC
The CanonicalHref extension

http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/CanonicalHref/CanonicalHref.php

does not work with the 1.16svn skins. Attached is a patch that makes it work on my system. Changed the hook and used wgOut->addLink instead of

$template->set('headlinks', $template->data['headlinks'] . "\n" . $link . "\n");

Not sure if this is the correct way, but seems to be more compatible than adding \n$link\n to the end of a template section.
Comment 1 Jools Wills 2009-10-18 19:51:42 UTC
Created attachment 6679 [details]
diff file for with fixes
Comment 2 Brion Vibber 2009-10-19 22:55:17 UTC
rel="canonical" links are produced by MediaWiki 1.16; this extension is obsolete.
Comment 3 Jools Wills 2009-10-20 00:28:54 UTC
I am running rev 57770 from svn, and without this extension I see no rel="canonical" in the outputted source. does it need to be enabled somehow ?
Comment 4 Brion Vibber 2009-10-20 00:33:53 UTC
Trust me it's there. :)

Article::showRedirectedFromHeader() includes:

		// Add a <link rel="canonical"> tag
		$wgOut->addLink( array( 'rel' => 'canonical',
			'href' => $this->mTitle->getLocalURL() )
		);


Possibilities:
1) you're not looking at a redirected page (if it doesn't say "Redirected from XYZ" in the subtitle space, it's not a redirect view)
2) you're running a release branch that's not 1.16 (revision number that you svn up'd to doesn't tell you what branch your own)
3) you have an extension that overrides ArticleViewRedirect hook and replaces the behavior.


Comment 5 Brion Vibber 2009-10-20 00:45:56 UTC
Reopening as enhancement -- apparently reporter wants things other than just redirects labeled, such as views with extra URL parameters that don't affect the display significantly. Apparently at least some subset of these cases is covered by the extension that isn't covered in core; where useful this should be integrated.
Comment 6 Jools Wills 2009-10-20 00:53:33 UTC
the "such as views with extra URL parameters that don't affect
the display significantly" is the most important thing to me. this is where I believe not having a canonical url is most damaging when it comes to search rank.  I rather have a few places where perhaps it says the canonical url is Foo when infact its the Foo "history" (so they get marked as the same page for hits etc), rather than 18,000 pages all with 5 entry points with no canonical url hint at all.

Adding a selective case like this is beyond my knowledge of mediawiki, so I shall continue using the extension + patch.
Comment 7 Brion Vibber 2009-10-20 13:44:47 UTC
Note that action=history gives completely different content from a page view; it would be absolutely wrong to emit a rel=canonical link pointing to the article, and we would definitely not do that. (Nor would that be something I'd worry about from an SEO perspective -- who on earth is going to link to article history pages all the time?)

It might make sense for an action=history&offset=200908124455 link to point to action=history... but both of them will be marked as not indexable anyway, so there's no point.

The cases where we'd realistically want a rel=canonical for things that aren't redirects are probably going to be things like permalinks or links with ?curid from RC patrol etc.
Comment 8 Bryan Tong Minh 2009-10-20 14:01:56 UTC
(In reply to comment #7)
> who on earth is going to link to article
> history pages all the time?)
> 
Something like a source link?

This article is copied from <a href="http://link/to/page">some wiki</a>. See its <a href="http://link/to/page?action=history">history</a> for a list of authors.
Comment 9 Jools Wills 2009-12-01 23:48:53 UTC
Whether or not my patch is the right way to do it, or whether the extension is considered obsolete, I rather like it, and since the extension doesn't work at all without my patch, it surely isn't a problem to commit it? those who dont want to use its "broken functionality" can just not use it?
Comment 10 Siebrand Mazeland 2010-01-09 19:04:57 UTC
Applied in r60870. Thanks.
Comment 11 Aryeh Gregor (not reading bugmail, please e-mail directly) 2010-01-10 23:41:00 UTC
I've completely deleted the extension in r60913, because it was broken and very likely useless.  If you have any specific cases where you think rel="canonical" should actually be output, per its definition and intended use, please open new bugs requesting that this be added to core (feel free to assign to me).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links