Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -340,6 +340,8 @@ |
341 | 341 | 'hiddencat' => array( 1, '__HIDDENCAT__' ), |
342 | 342 | 'pagesincategory' => array( 1, 'PAGESINCATEGORY', 'PAGESINCAT' ), |
343 | 343 | 'pagesize' => array( 1, 'PAGESIZE' ), |
| 344 | + 'index' => array( 1, '__INDEX__' ), |
| 345 | + 'noindex' => array( 1, '__NOINDEX__' ), |
344 | 346 | ); |
345 | 347 | |
346 | 348 | /** |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -3380,6 +3380,15 @@ |
3381 | 3381 | wfDebug( __METHOD__.": [[MediaWiki:hidden-category-category]] is not a valid title!\n" ); |
3382 | 3382 | } |
3383 | 3383 | } |
| 3384 | + # (bug 8068) Allow control over whether robots index a page. FIXME: |
| 3385 | + # __INDEX__ always overrides __NOINDEX__ here! This is not desirable, |
| 3386 | + # the last one on the page should win. |
| 3387 | + if( isset( $this->mDoubleUnderscores['noindex'] ) ) { |
| 3388 | + $this->mOutput->setIndexPolicy( 'noindex' ); |
| 3389 | + } elseif( isset( $this->mDoubleUnderscores['index'] ) ) { |
| 3390 | + $this->mOutput->setIndexPolicy( 'index' ); |
| 3391 | + } |
| 3392 | + |
3384 | 3393 | return $text; |
3385 | 3394 | } |
3386 | 3395 | |
Index: trunk/phase3/includes/parser/ParserOutput.php |
— | — | @@ -24,6 +24,7 @@ |
25 | 25 | $mWarnings, # Warning text to be returned to the user. Wikitext formatted, in the key only |
26 | 26 | $mSections, # Table of contents |
27 | 27 | $mProperties; # Name/value pairs to be cached in the DB |
| 28 | + private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change. |
28 | 29 | |
29 | 30 | /** |
30 | 31 | * Overridden title for display |
— | — | @@ -69,6 +70,7 @@ |
70 | 71 | function getSubtitle() { return $this->mSubtitle; } |
71 | 72 | function getOutputHooks() { return (array)$this->mOutputHooks; } |
72 | 73 | function getWarnings() { return array_keys( $this->mWarnings ); } |
| 74 | + function getIndexPolicy() { return $this->mIndexPolicy; } |
73 | 75 | |
74 | 76 | function containsOldMagic() { return $this->mContainsOldMagic; } |
75 | 77 | function setText( $text ) { return wfSetVar( $this->mText, $text ); } |
— | — | @@ -78,6 +80,7 @@ |
79 | 81 | function setCacheTime( $t ) { return wfSetVar( $this->mCacheTime, $t ); } |
80 | 82 | function setTitleText( $t ) { return wfSetVar( $this->mTitleText, $t ); } |
81 | 83 | function setSections( $toc ) { return wfSetVar( $this->mSections, $toc ); } |
| 84 | + function setIndexPolicy( $policy ) { return wfSetVar( $this->mIndexPolicy, $policy ); } |
82 | 85 | |
83 | 86 | function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; } |
84 | 87 | function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; } |
Index: trunk/phase3/includes/MagicWord.php |
— | — | @@ -105,6 +105,8 @@ |
106 | 106 | 'numberofadmins', |
107 | 107 | 'defaultsort', |
108 | 108 | 'pagesincategory', |
| 109 | + 'index', |
| 110 | + 'noindex', |
109 | 111 | ); |
110 | 112 | |
111 | 113 | /* Array of caching hints for ParserCache */ |
— | — | @@ -153,6 +155,8 @@ |
154 | 156 | 'noeditsection', |
155 | 157 | 'newsectionlink', |
156 | 158 | 'hiddencat', |
| 159 | + 'index', |
| 160 | + 'noindex', |
157 | 161 | ); |
158 | 162 | |
159 | 163 | |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -475,6 +475,8 @@ |
476 | 476 | $this->mLanguageLinks += $parserOutput->getLanguageLinks(); |
477 | 477 | $this->addCategoryLinks( $parserOutput->getCategories() ); |
478 | 478 | $this->mNewSectionLink = $parserOutput->getNewSection(); |
| 479 | + # FIXME: This probably overrides $wgArticleRobotPolicies, is that wise? |
| 480 | + $this->setIndexPolicy( $parserOutput->getIndexPolicy() ); |
479 | 481 | $this->addKeywords( $parserOutput ); |
480 | 482 | $this->mParseWarnings = $parserOutput->getWarnings(); |
481 | 483 | if ( $parserOutput->getCacheTime() == -1 ) { |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -24,7 +24,8 @@ |
25 | 25 | |
26 | 26 | === New features in 1.14 === |
27 | 27 | |
28 | | -None yet |
| 28 | +* (bug 8068) New __INDEX__ and __NOINDEX__ magic words allow control of search |
| 29 | +engine indexing on a per-article basis. |
29 | 30 | |
30 | 31 | === Bug fixes in 1.14 === |
31 | 32 | |