Loading
0

如何给WordPress评论链接加上nofollow

WordPress评论链接函数comments_popup_link()会在链接处生产

文章链接#comments

这样的链接,#comments是指向文章页面评论模块的意思,但是搜索引擎会抓取到 文章链接 与 文章链接#comments 视为同一篇文章多个链接,对 SEO 不是很友好。

WordPress 评论链接加上 nofollow 的方法就是在WordPress主题functions.php 文件中加入:

function add_nofollow_to_comments_popup_link(){

return ' rel="nofollow" ';

}

add_filter('comments_popup_link_attributes', 'add_nofollow_to_comments_popup_link');