怎么去除wordpress中评论中的nofollow
怎么去除wordpress 中评论中的nofollow我们经常会遇到nofollow 属性,特别是wordpress 的评论会自动添加上external nofollow 属性。那么什么是nofoll
怎么去除wordpress 中评论中的nofollow
我们经常会遇到nofollow 属性,特别是wordpress 的评论会自动添加上external nofollow 属性。那么什么是nofollow 呢? 在我们不想要的时候怎么能去掉呢?
我们先来看一下什么是nofollow 。NoFollow 是Google 几年前提出的一个新标签,目的是减少垃圾留言。此标签表明链接与网站作者无关,也就是说搜索引擎不会用这个链接计算网站的 PR 值。很多博客程序都会自动在评论链接中加上nofollow 标签。现在主流的Blog 程序,如WordPress 和MovableType 、z-blog 等等,均默在其留言的链接中自动添加nofollow 属性。在wordpress 中加的是rel=” external nofollow”.例:Mitzie Farrer这段代码是沉缘seo 在自己的小站源代码中找到的external nofollow 属性。
那么nofollow 与external nofollow有区别吗? 在没明白二者的区别前我们先来了解一下二者的意思,rel=‟external nofollow‟与rel=‟nofollow‟其功能就中文译文”不要读取” 及”外部链接不要读取”的意思! 由此可见二者的作用是相同的,只不过external nofollow 是比nofollow 更专业的写法,即明确指出链接为外部链接,蜘蛛可以略过。
当我们不想让评论中的链接带有nofollow 或者external nofollow 属性时,该怎么去掉呢? 本文由 过期域名抢注www.yumichong.cn 域名抢注 整理
那么请打开我们的wordpress ,然后找到wp-include 文件夹,打开comment-template.php 页面,找到如下代码:
function get_comment_author_link( $comment_ID = 0 ) {
/** @todo Only call these functions when they are needed. Include in if… else blocks */
$url = get_comment_author_url( $comment_ID );
$author = get_comment_author( $comment_ID );
i f ( empty( $url ) || „http://‟ == $url )
$return = $author;
else
$return = “$author”;
return apply_filters(„get_comment_author_link‟, $return);
}
在这些代码,去掉rel=‟external nofollow‟或者把这行代码换做target=‟_blank‟。这样我们的评论中就不会再出现external follow了。