Manual:$wgNoFollowLinks/zh

详情
如果设置为true，在维基文本中的外部链接将会被赋予 属性，暗示搜索引擎不应该追踪用户提供的链接和垃圾信息的链接，防止影响搜索排名. 默认为true.

Setting nofollow for red links
It may be desirable to configure MW to append  to internal links that point to pages that haven't yet been written (so-called "red links") for various reasons that include avoiding unnecessary crawler traffic to non-extant pages or for the possibility of improved SEO by avoiding punitive action against a site's ranking due to the presence of "broken links" that aren't broken, just not yet authored.

This may be accomplished by using the  hook as follows:

// Add rel="nofollow" to links to pages that don't exist (redlinks) $wgHooks['HtmlPageLinkRendererEnd'][] = 'noFollowRedLinks'; function noFollowRedLinks( $linkRenderer, $target, $isKnown, &$text, &$attribs, &$ret ) { if (!$isKnown && preg_match('/\bnew\b/S', $attribs['class'] ?? "")) { 		$attribs['rel'] = 'nofollow'; } 	return true; }



另请参阅

 * - 管理白名单的最简单方式（自从nofollow不适用于跨维基链接时）.
 * nofollow，在元维基上讨论nofollow在维基媒体网站上的使用. 有些观点可能也适用于其他维基的决定此配置的设置.
 * - 管理白名单的最简单方式（自从nofollow不适用于跨维基链接时）.
 * nofollow，在元维基上讨论nofollow在维基媒体网站上的使用. 有些观点可能也适用于其他维基的决定此配置的设置.
 * nofollow，在元维基上讨论nofollow在维基媒体网站上的使用. 有些观点可能也适用于其他维基的决定此配置的设置.