From 88074c62a9f19598202a181dd14b09e098e1258d Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sun, 14 Jan 2007 21:28:23 +0000 Subject: [PATCH] (bug 8407) Disallow indexing of "printable" versions --- RELEASE-NOTES | 1 + includes/Article.php | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1c839c77c2..b74d0cfed8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -68,6 +68,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 8632) Fix regression in page protection null edit update * (bug 7842) Link back to deleted revision list from deleted revision preview * (bug 8619) Add user-aware "unblock" link to Special:Blockip +* (bug 8407) Disallow indexing of "printable" versions == Languages updated == diff --git a/includes/Article.php b/includes/Article.php index ab6ad0a4c3..bee90bf8ca 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -630,14 +630,18 @@ class Article { $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) ); $wgOut->setArticleFlag( true ); - if ( isset( $wgNamespaceRobotPolicies[$ns] ) ) { + + # Discourage indexing of printable versions, but encourage following + if( $wgOut->isPrintable() ) { + $policy = 'noindex,follow'; + } elseif( isset( $wgNamespaceRobotPolicies[$ns] ) ) { + # Honour customised robot policies for this namespace $policy = $wgNamespaceRobotPolicies[$ns]; } else { - # The default policy. Dev note: make sure you change the documentation - # in DefaultSettings.php before changing it. + # Default to encourage indexing and following links $policy = 'index,follow'; } - $wgOut->setRobotpolicy( $policy ); + $wgOut->setRobotPolicy( $policy ); # If we got diff and oldid in the query, we want to see a # diff page instead of the article. -- 2.20.1