Manual:Noindex

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Noindex can be used to prevent indexing of a page by search engines.

Using Wikitext

To change the index preferences for specific pages, use one of these magic words:

  • __INDEX__
  • __NOINDEX__

These magic words work for a given namespace. One may need to adjust $wgExemptFromUserRobotsControl.

To test whether they function for a given page, you can use the PHP function Title::canUseNoindex().

Using site Configuration

There are some site configurations that can be set. Some of them:

Using PHP

An example code in PHP, for example to be used by extension developers, would be:

$wgOut->setRobotPolicy('noindex,nofollow');

Or, if one wished to be more selective:

$wgOut->setIndexPolicy('noindex');

See also