r30602 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r30601‎ | r30602 | r30603 >
Date:00:55, 6 February 2008
Author:vyznev
Status:old (Comments)
Tags:
Comment:
Make the default robot policy a configurable option.

Also replace some odd hardcoded robot policies (for Special:Specialpages and for nonexistent images) with 'noindex,nofollow', which seems more
appropriate at least for the latter. I'm not quite sure _why_ Special:Specialpages was marked as 'index,nofollow' before; it's been that way since
r1284. It might be safe to just leave it at the default setting, but I don't really think it makes much difference either way.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/SpecialSpecialpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -613,6 +613,7 @@
614614 global $wgUser, $wgOut, $wgRequest, $wgContLang;
615615 global $wgEnableParserCache, $wgStylePath, $wgParser;
616616 global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgArticleRobotPolicies;
 617+ global $wgDefaultRobotPolicy;
617618 $sk = $wgUser->getSkin();
618619
619620 wfProfileIn( __METHOD__ );
@@ -647,8 +648,7 @@
648649 # Honour customised robot policies for this namespace
649650 $policy = $wgNamespaceRobotPolicies[$ns];
650651 } else {
651 - # Default to encourage indexing and following links
652 - $policy = 'index,follow';
 652+ $policy = $wgDefaultRobotPolicy;
653653 }
654654 $wgOut->setRobotPolicy( $policy );
655655
Index: trunk/phase3/includes/ImagePage.php
@@ -69,7 +69,7 @@
7070 } else {
7171 # Just need to set the right headers
7272 $wgOut->setArticleFlag( true );
73 - $wgOut->setRobotpolicy( 'index,follow' );
 73+ $wgOut->setRobotpolicy( 'noindex,nofollow' );
7474 $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
7575 $this->viewUpdates();
7676 }
Index: trunk/phase3/includes/SpecialSpecialpages.php
@@ -12,7 +12,7 @@
1313
1414 $wgMessageCache->loadAllMessages();
1515
16 - $wgOut->setRobotpolicy( 'index,nofollow' );
 16+ $wgOut->setRobotpolicy( 'noindex,nofollow' ); # Is this really needed?
1717 $sk = $wgUser->getSkin();
1818
1919 /** Pages available to all */
Index: trunk/phase3/includes/DefaultSettings.php
@@ -2485,8 +2485,15 @@
24862486 $wgNoFollowNsExceptions = array();
24872487
24882488 /**
 2489+ * Default robot policy.
 2490+ * The default policy is to encourage indexing and following of links.
 2491+ * It may be overridden on a per-namespace and/or per-page basis.
 2492+ */
 2493+$wgDefaultRobotPolicy = 'index,follow';
 2494+
 2495+/**
24892496 * Robot policies per namespaces.
2490 - * The default policy is 'index,follow', the array is made of namespace
 2497+ * The default policy is given above, the array is made of namespace
24912498 * constants as defined in includes/Defines.php
24922499 * Example:
24932500 * $wgNamespaceRobotPolicies = array( NS_TALK => 'noindex' );
Index: trunk/phase3/RELEASE-NOTES
@@ -155,6 +155,8 @@
156156 * (bug 10365) Localization of Special:Version
157157 * When installing using Postgres, the Pl/Pgsql language is now checked for
158158 and installed when at the superuser level.
 159+* The default robot policy for the entire wiki is now configurable via the
 160+ $wgDefaultRobotPolicy setting.
159161
160162 === Bug fixes in 1.12 ===
161163

Follow-up revisions

RevisionCommit summaryAuthorDate
r47838Fix regression from r30602. 'noindex,nofollow' was being applied when local p...demon20:10, 26 February 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r1284Initial revisionlcrocker23:10, 14 April 2003

Comments

#Comment by Brion VIBBER (talk | contribs)   19:54, 18 February 2009

Regression? This causes image pages to no longer be indexed or followed when there's not local page text.

#Comment by 😂 (talk | contribs)   22:32, 3 March 2009

Should be resolved in r47838.

Status & tagging log