Revert r47388 / 8d9243cf3: Use Title::getLocalURL() for rel=canonical links
authorOri Livneh <ori@wikimedia.org>
Wed, 24 Jun 2015 03:21:16 +0000 (20:21 -0700)
committerOri Livneh <ori@wikimedia.org>
Wed, 24 Jun 2015 05:17:01 +0000 (22:17 -0700)
Using relative links for <link rel=canonical> is a missed chance to signal the
preferred hostname and protocol for accessing our sites, which invites Google
(and other search engines) to guess, or to treat the request URL's hostname as
canonical. Compared to that, the number of bytes saved by using a relative link
is insubstantial.

Change-Id: I483b4425c1c14211e67bbb6e7ae077b7faa4ee25

includes/page/Article.php

index 450251a..053753e 100644 (file)
@@ -1000,7 +1000,7 @@ class Article implements Page {
                                $outputPage->addModules( 'mediawiki.action.view.redirect' );
 
                                // Add a <link rel="canonical"> tag
-                               $outputPage->setCanonicalUrl( $this->getTitle()->getLocalURL() );
+                               $outputPage->setCanonicalUrl( $this->getTitle()->getCanonicalURL() );
 
                                // Tell the output object that the user arrived at this article through a redirect
                                $outputPage->setRedirectedFrom( $this->mRedirectedFrom );