Add a <link rel="canonical"> tag on redirected page views per <http://googlewebmaster...
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 13 Feb 2009 16:17:39 +0000 (16:17 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 13 Feb 2009 16:17:39 +0000 (16:17 +0000)
RELEASE-NOTES
includes/Article.php

index 5ce56ed..d3ab9e6 100644 (file)
@@ -97,6 +97,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Add NUMBEROFACTIVEUSERS magic word, which is like NUMBEROFUSERS, but uses
   the active users data from site_stats.
 * (bug 13040) Gender-aware user namespace aliases
+* Add a <link rel="canonical"> tag on redirected page views
 
 === Bug fixes in 1.15 ===
 * (bug 16968) Special:Upload no longer throws useless warnings.
index 28928fe..82e3388 100644 (file)
@@ -836,6 +836,11 @@ class Article {
                                        $fragment = Xml::escapeJsString( $this->mTitle->getFragmentForURL() );
                                        $wgOut->addInlineScript( "redirectToFragment(\"$fragment\");" );
                                }
+
+                               // Add a <link rel="canonical"> tag
+                               $wgOut->addLink( array( 'rel' => 'canonical',
+                                       'href' => $this->mTitle->getFullURL() )
+                               );
                                $wasRedirected = true;
                        }
                } elseif( !empty( $rdfrom ) ) {