Index: trunk/phase3/includes/parser/Parser.php
===================================================================
--- trunk/phase3/includes/parser/Parser.php (revision 37972)
+++ trunk/phase3/includes/parser/Parser.php (revision 37973)
@@ -3380,6 +3380,15 @@
wfDebug( __METHOD__.": [[MediaWiki:hidden-category-category]] is not a valid title!\n" );
}
}
+ # (bug 8068) Allow control over whether robots index a page. FIXME:
+ # __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' );
+ }
+
return $text;
}
Index: trunk/phase3/includes/parser/ParserOutput.php
===================================================================
--- trunk/phase3/includes/parser/ParserOutput.php (revision 37972)
+++ trunk/phase3/includes/parser/ParserOutput.php (revision 37973)
@@ -24,6 +24,7 @@
$mWarnings, # Warning text to be returned to the user. Wikitext formatted, in the key only
$mSections, # Table of contents
$mProperties; # Name/value pairs to be cached in the DB
+ private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change.
/**
* Overridden title for display
@@ -69,6 +70,7 @@
function getSubtitle() { return $this->mSubtitle; }
function getOutputHooks() { return (array)$this->mOutputHooks; }
function getWarnings() { return array_keys( $this->mWarnings ); }
+ function getIndexPolicy() { return $this->mIndexPolicy; }
function containsOldMagic() { return $this->mContainsOldMagic; }
function setText( $text ) { return wfSetVar( $this->mText, $text ); }
@@ -78,6 +80,7 @@
function setCacheTime( $t ) { return wfSetVar( $this->mCacheTime, $t ); }
function setTitleText( $t ) { return wfSetVar( $this->mTitleText, $t ); }
function setSections( $toc ) { return wfSetVar( $this->mSections, $toc ); }
+ function setIndexPolicy( $policy ) { return wfSetVar( $this->mIndexPolicy, $policy ); }
function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; }
function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; }
Index: trunk/phase3/includes/OutputPage.php
===================================================================
--- trunk/phase3/includes/OutputPage.php (revision 37972)
+++ trunk/phase3/includes/OutputPage.php (revision 37973)
@@ -475,6 +475,8 @@
$this->mLanguageLinks += $parserOutput->getLanguageLinks();
$this->addCategoryLinks( $parserOutput->getCategories() );
$this->mNewSectionLink = $parserOutput->getNewSection();
+ # FIXME: This probably overrides $wgArticleRobotPolicies, is that wise?
+ $this->setIndexPolicy( $parserOutput->getIndexPolicy() );
$this->addKeywords( $parserOutput );
$this->mParseWarnings = $parserOutput->getWarnings();
if ( $parserOutput->getCacheTime() == -1 ) {
Index: trunk/phase3/includes/MagicWord.php
===================================================================
--- trunk/phase3/includes/MagicWord.php (revision 37972)
+++ trunk/phase3/includes/MagicWord.php (revision 37973)
@@ -105,6 +105,8 @@
'numberofadmins',
'defaultsort',
'pagesincategory',
+ 'index',
+ 'noindex',
);
/* Array of caching hints for ParserCache */
@@ -153,6 +155,8 @@
'noeditsection',
'newsectionlink',
'hiddencat',
+ 'index',
+ 'noindex',
);
Index: trunk/phase3/languages/messages/MessagesEn.php
===================================================================
--- trunk/phase3/languages/messages/MessagesEn.php (revision 37972)
+++ trunk/phase3/languages/messages/MessagesEn.php (revision 37973)
@@ -340,6 +340,8 @@
'hiddencat' => array( 1, '__HIDDENCAT__' ),
'pagesincategory' => array( 1, 'PAGESINCATEGORY', 'PAGESINCAT' ),
'pagesize' => array( 1, 'PAGESIZE' ),
+ 'index' => array( 1, '__INDEX__' ),
+ 'noindex' => array( 1, '__NOINDEX__' ),
);
/**
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES (revision 37972)
+++ trunk/phase3/RELEASE-NOTES (revision 37973)
@@ -24,7 +24,8 @@
=== New features in 1.14 ===
-None yet
+* (bug 8068) New __INDEX__ and __NOINDEX__ magic words allow control of search
+engine indexing on a per-article basis.
=== Bug fixes in 1.14 ===