r47217 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47216‎ | r47217 | r47218 >
Date:16:17, 13 February 2009
Author:catrope
Status:ok (Comments)
Tags:
Comment:
Add a <link rel="canonical"> tag on redirected page views per <http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html&gt;
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -836,6 +836,11 @@
837837 $fragment = Xml::escapeJsString( $this->mTitle->getFragmentForURL() );
838838 $wgOut->addInlineScript( "redirectToFragment(\"$fragment\");" );
839839 }
 840+
 841+ // Add a <link rel="canonical"> tag
 842+ $wgOut->addLink( array( 'rel' => 'canonical',
 843+ 'href' => $this->mTitle->getFullURL() )
 844+ );
840845 $wasRedirected = true;
841846 }
842847 } elseif( !empty( $rdfrom ) ) {
Index: trunk/phase3/RELEASE-NOTES
@@ -97,6 +97,7 @@
9898 * Add NUMBEROFACTIVEUSERS magic word, which is like NUMBEROFUSERS, but uses
9999 the active users data from site_stats.
100100 * (bug 13040) Gender-aware user namespace aliases
 101+* Add a <link rel="canonical"> tag on redirected page views
101102
102103 === Bug fixes in 1.15 ===
103104 * (bug 16968) Special:Upload no longer throws useless warnings.

Follow-up revisions

RevisionCommit summaryAuthorDate
r47388Follow-up to r47217 "Add a <link rel="canonical"> tag on redirected page view...brion22:51, 17 February 2009

Comments

#Comment by Catrope (talk | contribs)   16:19, 13 February 2009

Hmm, this seems to be a bug in CodeReview's pretty-printing of commit messages: <url> is rendered as a < sign, followed by the URL with &gt appended linked, followed by a ;

Proper URL is http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html

#Comment by Brion VIBBER (talk | contribs)   22:52, 17 February 2009

Switched this to a local URL path in r47388 to save a few bytes of output.

We might want to consider expanding this stuff in future for alternate SSL paths though.

Status & tagging log