Manual:$wgNoFollowLinks

This page is a translated version of the page Manual:$wgNoFollowLinks and the translation is 58% complete.
構文解析: $wgNoFollowLinks
true の場合、ウィキテキスト内の外部 URL リンクに rel="nofollow" 属性を追加します。
導入されたバージョン:1.4.0 (r7174)
除去されたバージョン:使用中
許容される値:(真偽値)
既定値:true

詳細

true の場合、ウィキテキストの外部 URL リンクに rel="nofollow" 属性を追加します。この属性は、スパム攻撃の影響を避けるため、ランク付け目的で追跡すべきではないと伝えるための、検索エンジン向けのヒントとして使用されます。既定値は true です。

It may be desirable to configure MW to append rel="nofollow" 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 HtmlPageLinkRendererEnd 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;
}

関連項目

  • meta:nofollow, Meta-Wiki discussion on nofollow's use on Wikimedia sites. Some of the arguments raised there may also applicable to other wikis' decisions concerning this configuration setting.