怎么去除wordpress中評(píng)論中的nofollow
怎么去除wordpress 中評(píng)論中的nofollow我們經(jīng)常會(huì)遇到nofollow 屬性,特別是wordpress 的評(píng)論會(huì)自動(dòng)添加上external nofollow 屬性。那么什么是nofoll
怎么去除wordpress 中評(píng)論中的nofollow
我們經(jīng)常會(huì)遇到nofollow 屬性,特別是wordpress 的評(píng)論會(huì)自動(dòng)添加上external nofollow 屬性。那么什么是nofollow 呢? 在我們不想要的時(shí)候怎么能去掉呢?
我們先來看一下什么是nofollow 。NoFollow 是Google 幾年前提出的一個(gè)新標(biāo)簽,目的是減少垃圾留言。此標(biāo)簽表明鏈接與網(wǎng)站作者無關(guān),也就是說搜索引擎不會(huì)用這個(gè)鏈接計(jì)算網(wǎng)站的 PR 值。很多博客程序都會(huì)自動(dòng)在評(píng)論鏈接中加上nofollow 標(biāo)簽?,F(xiàn)在主流的Blog 程序,如WordPress 和MovableType 、z-blog 等等,均默在其留言的鏈接中自動(dòng)添加nofollow 屬性。在wordpress 中加的是rel=” external nofollow”.例:Mitzie Farrer這段代碼是沉緣seo 在自己的小站源代碼中找到的external nofollow 屬性。
那么nofollow 與external nofollow有區(qū)別嗎? 在沒明白二者的區(qū)別前我們先來了解一下二者的意思,rel=?external nofollow?與rel=?nofollow?其功能就中文譯文”不要讀取” 及”外部鏈接不要讀取”的意思! 由此可見二者的作用是相同的,只不過external nofollow 是比nofollow 更專業(yè)的寫法,即明確指出鏈接為外部鏈接,蜘蛛可以略過。
當(dāng)我們不想讓評(píng)論中的鏈接帶有nofollow 或者external nofollow 屬性時(shí),該怎么去掉呢? 本文由 過期域名搶注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?。這樣我們的評(píng)論中就不會(huì)再出現(xiàn)external follow了。