Index: includes/parser/Parser.php =================================================================== --- includes/parser/Parser.php (revision 50499) +++ includes/parser/Parser.php (working copy) @@ -3309,6 +3309,7 @@ * Fills $this->mDoubleUnderscores, returns the modified text */ function doDoubleUnderscore( $text ) { + global $wgExemptFromUserRobotsControl, $wgArticleRobotPolicies, $wgContentNamespaces; wfProfileIn( __METHOD__ ); // The position of __TOC__ needs to be recorded $mw = MagicWord::get( 'toc' ); @@ -3347,11 +3348,30 @@ # # FIXME (bug 14899): __INDEX__ always overrides __NOINDEX__ here! This # is not desirable, the last one on the page should win. - if( isset( $this->mDoubleUnderscores['noindex'] ) ) { - $this->mOutput->setIndexPolicy( 'noindex' ); - } elseif( isset( $this->mDoubleUnderscores['index'] ) ) { - $this->mOutput->setIndexPolicy( 'index' ); + if( is_null( $wgExemptFromUserRobotsControl ) ) { + $bannedNamespaces = $wgContentNamespaces; + } else { + $bannedNamespaces = $wgExemptFromUserRobotsControl; } + if( !isset( $wgArticleRobotPolicies[$this->mTitle->getPrefixedText()] ) && !in_array( $this->mTitle->getNamespace(), $bannedNamespaces ) ) { + if( isset( $this->mDoubleUnderscores['noindex'] ) ) { + $noindexCategory = Title::makeTitleSafe( NS_CATEGORY, wfMsgForContent( 'robots-noindex-category' ) ); + if( $noindexCategory ) { + $this->mOutput->addCategory( $noindexCategory->getDBkey(), $this->getDefaultSort() ); + } else { + wfDebug( __METHOD__.": [[MediaWiki:robots-noindex-category]] is not a valid title!\n" ); + } + $this->mOutput->setIndexPolicy( 'noindex' ); + } elseif( isset( $this->mDoubleUnderscores['index'] ) ) { + $indexCategory = Title::makeTitleSafe( NS_CATEGORY, wfMsgForContent( 'robots-index-category' ) ); + if( $indexCategory ) { + $this->mOutput->addCategory( $indexCategory->getDBkey(), $this->getDefaultSort() ); + } else { + wfDebug( __METHOD__.": [[MediaWiki:robots-index-category]] is not a valid title!\n" ); + } + $this->mOutput->setIndexPolicy( 'index' ); + } + } wfProfileOut( __METHOD__ ); return $text; } Index: includes/OutputPage.php =================================================================== --- includes/OutputPage.php (revision 50499) +++ includes/OutputPage.php (working copy) @@ -554,23 +554,12 @@ * @param ParserOutput object &$parserOutput */ public function addParserOutputNoText( &$parserOutput ) { - global $wgExemptFromUserRobotsControl, $wgContentNamespaces; - $this->mLanguageLinks += $parserOutput->getLanguageLinks(); $this->addCategoryLinks( $parserOutput->getCategories() ); $this->mNewSectionLink = $parserOutput->getNewSection(); $this->mHideNewSectionLink = $parserOutput->getHideNewSection(); - if( is_null( $wgExemptFromUserRobotsControl ) ) { - $bannedNamespaces = $wgContentNamespaces; - } else { - $bannedNamespaces = $wgExemptFromUserRobotsControl; - } - if( !in_array( $this->getTitle()->getNamespace(), $bannedNamespaces ) ) { - # FIXME (bug 14900): This overrides $wgArticleRobotPolicies, and it - # shouldn't - $this->setIndexPolicy( $parserOutput->getIndexPolicy() ); - } + $this->setIndexPolicy( $parserOutput->getIndexPolicy() ); $this->addKeywords( $parserOutput ); $this->mParseWarnings = $parserOutput->getWarnings(); Index: languages/messages/MessagesEn.php =================================================================== --- languages/messages/MessagesEn.php (revision 50499) +++ languages/messages/MessagesEn.php (working copy) @@ -615,6 +615,8 @@ 'category-file-count' => '{{PLURAL:$2|This category contains only the following file.|The following {{PLURAL:$1|file is|$1 files are}} in this category, out of $2 total.}}', 'category-file-count-limited' => 'The following {{PLURAL:$1|file is|$1 files are}} in the current category.', 'listingcontinuesabbrev' => 'cont.', +'robots-noindex-category' => 'Non-indexed pages', +'robots-index-category' => 'Indexed pages', 'linkprefix' => '/^(.*?)([a-zA-Z\\x80-\\xff]+)$/sD', # only translate this message to other languages if you have to change it 'mainpagetext' => "'''MediaWiki has been successfully installed.'''",